diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c522c0f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,33 @@ +name: CI + +# Build and load checks. Everything that needs a credential runs elsewhere and reports +# back as a commit status, so no secret is reachable from this workflow. + +on: + pull_request: + push: + branches: [master, main] + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + name: build (php ${{ matrix.php }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: ['8.2', '8.3', '8.4'] + steps: + - uses: actions/checkout@v4 + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + - run: composer install --no-interaction --no-progress + - name: Lint every source file + run: find src -name '*.php' -print0 | xargs -0 -n1 php -l > /dev/null diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..80a0e74 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: Release + +# PHP has no publish step: Packagist reads the tag pushed by tag-on-merge.yml and needs no +# credential (FR-021a). This workflow only asserts the tag and the manifest agree, so a mismatched +# release is caught here rather than silently published by Packagist. + +on: + push: + tags: ['v[0-9]+.[0-9]+.[0-9]+'] + +permissions: + contents: write # create the GitHub release + +jobs: + verify: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: The tag must match the packaged version + run: | + # Every tag in this repository, and in api-reference, carries the v. The version + # inside the package never does, so the tag is compared with it stripped. + TAG="${GITHUB_REF_NAME#v}" + PKG="$(cat VERSION)" + [ "$TAG" = "$PKG" ] || { echo "tag $TAG != VERSION $PKG"; exit 1; } + echo "Packagist will pick up tag $TAG from its repository webhook." + + # The tag alone left the repository's Releases page showing a version from years ago as + # "Latest", which is what anyone browsing the repository sees first. The notes come from the + # CHANGELOG section for this version, so the release says what changed rather than nothing. + - name: Publish the GitHub release + env: + GH_TOKEN: ${{ github.token }} + run: | + VERSION="${GITHUB_REF_NAME#v}" + NOTES="$(awk -v v="$VERSION" ' + $0 ~ "^## \\[?" v "\\]?" { found = 1; next } + found && /^## / { exit } + found { print } + ' CHANGELOG.md)" + [ -n "$NOTES" ] || NOTES="See CHANGELOG.md for $VERSION." + # Creating one that exists is an error, and a re-run of a release that already happened + # should be a no-op rather than a red build. + if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then + echo "Release $GITHUB_REF_NAME already exists; nothing to do." + else + gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --notes "$NOTES" + fi diff --git a/.github/workflows/tag-on-merge.yml b/.github/workflows/tag-on-merge.yml new file mode 100644 index 0000000..78ca09a --- /dev/null +++ b/.github/workflows/tag-on-merge.yml @@ -0,0 +1,40 @@ +name: Tag on merge + +# Merging is what creates the version tag, and the tag is what publishes (FR-007f, FR-019a). +# A breaking release waits for a human to merge, which is how the FR-019 approval is expressed. + +on: + push: + branches: [master, main] + +permissions: + contents: write + +jobs: + tag: + runs-on: ubuntu-latest + steps: + # SDK_RELEASE_TOKEN, not the automatic GITHUB_TOKEN. GitHub does not start a workflow run for + # an event created with GITHUB_TOKEN, so a tag pushed with it would never trigger release.yml + # and nothing would ever publish. That failure is silent: the tag appears, the release + # workflow simply never runs. Needs contents:write on this repository. + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.SDK_RELEASE_TOKEN }} + - name: Tag the version if it is new + run: | + test -n "${{ secrets.SDK_RELEASE_TOKEN }}" || { + echo "SDK_RELEASE_TOKEN is not set: the tag would not trigger release.yml"; exit 1; + } + # v-prefixed, matching every tag this repository and api-reference already carry. + # The version inside the package stays bare; only the git tag is prefixed. + VERSION="v$(cat VERSION)" + if git rev-parse "$VERSION" >/dev/null 2>&1; then + echo "Tag $VERSION already exists, nothing to do." + exit 0 + fi + git config user.name "Flat SDK bot" + git config user.email "developers@flat.io" + git tag -a "$VERSION" -m "Release $VERSION" + git push origin "$VERSION" diff --git a/.gitignore b/.gitignore index c422267..23bf4ed 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,10 @@ composer.phar # Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file # You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file # composer.lock + +# build artifacts +vendor/ +composer.phar +.sdkgen-scratch/ +.openapi-spec.yaml +.DS_Store diff --git a/.swagger-codegen-ignore b/.openapi-generator-ignore similarity index 100% rename from .swagger-codegen-ignore rename to .openapi-generator-ignore diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES new file mode 100644 index 0000000..1db65b3 --- /dev/null +++ b/.openapi-generator/FILES @@ -0,0 +1,634 @@ +.gitignore +.openapi-generator-ignore +.php-cs-fixer.dist.php +.phplint.yml +.travis.yml +README.md +composer.json +docs/Api/AccountApi.md +docs/Api/ClassApi.md +docs/Api/CollectionApi.md +docs/Api/EduResourcesApi.md +docs/Api/GroupApi.md +docs/Api/OMRApi.md +docs/Api/OrganizationApi.md +docs/Api/ScoreApi.md +docs/Api/TaskApi.md +docs/Api/UserApi.md +docs/Model/AddGroupUser200Response.md +docs/Model/AddGroupUserRequest.md +docs/Model/ApiAccessToken.md +docs/Model/AppScopes.md +docs/Model/Assignment.md +docs/Model/AssignmentCapabilities.md +docs/Model/AssignmentCapabilitiesCanPublishInClassError.md +docs/Model/AssignmentCopy.md +docs/Model/AssignmentCopyResponse.md +docs/Model/AssignmentCopyToClass.md +docs/Model/AssignmentCopyToResourceLibrary.md +docs/Model/AssignmentGroup.md +docs/Model/AssignmentSubmission.md +docs/Model/AssignmentSubmissionComment.md +docs/Model/AssignmentSubmissionCommentCreation.md +docs/Model/AssignmentSubmissionComments.md +docs/Model/AssignmentSubmissionHistory.md +docs/Model/AssignmentSubmissionHistoryAttachment.md +docs/Model/AssignmentSubmissionHistoryState.md +docs/Model/AssignmentSubmissionLti.md +docs/Model/AssignmentSubmissionPlayback.md +docs/Model/AssignmentSubmissionState.md +docs/Model/AssignmentSubmissionStudentsMode.md +docs/Model/AssignmentSubmissionUpdate.md +docs/Model/AssignmentType.md +docs/Model/AssignmentUpdate.md +docs/Model/ClassAssignment.md +docs/Model/ClassAssignmentAllOfCanvas.md +docs/Model/ClassAssignmentAllOfLti.md +docs/Model/ClassAssignmentAllOfMfc.md +docs/Model/ClassAssignmentUpdate.md +docs/Model/ClassAssignmentUpdateAllOfGoogleClassroom.md +docs/Model/ClassAssignmentUpdateAllOfMicrosoftGraph.md +docs/Model/ClassAttachmentCreation.md +docs/Model/ClassCreation.md +docs/Model/ClassDetails.md +docs/Model/ClassDetailsCanvas.md +docs/Model/ClassDetailsClever.md +docs/Model/ClassDetailsGoogleClassroom.md +docs/Model/ClassDetailsGoogleDrive.md +docs/Model/ClassDetailsIssues.md +docs/Model/ClassDetailsIssuesSyncInner.md +docs/Model/ClassDetailsLti.md +docs/Model/ClassDetailsMfc.md +docs/Model/ClassDetailsMicrosoftGraph.md +docs/Model/ClassGradeLevel.md +docs/Model/ClassRoles.md +docs/Model/ClassState.md +docs/Model/ClassUpdate.md +docs/Model/Collection.md +docs/Model/CollectionApp.md +docs/Model/CollectionCapabilities.md +docs/Model/CollectionContents.md +docs/Model/CollectionCreation.md +docs/Model/CollectionModification.md +docs/Model/CollectionPrivacy.md +docs/Model/CollectionType.md +docs/Model/CreditTransaction.md +docs/Model/EduLibrary.md +docs/Model/EduResource.md +docs/Model/EduResourceAssignmentCreation.md +docs/Model/EduResourceCapabilities.md +docs/Model/EduResourceCopy.md +docs/Model/EduResourceCreation.md +docs/Model/EduResourceFolder.md +docs/Model/EduResourceLtiLink.md +docs/Model/EduResourceMove.md +docs/Model/EduResourcePrivacy.md +docs/Model/EduResourceResource.md +docs/Model/EduResourceType.md +docs/Model/EduResourceUpdate.md +docs/Model/EduResourceUseInClass.md +docs/Model/FlatErrorResponse.md +docs/Model/GoogleClassroomCoursework.md +docs/Model/GoogleClassroomSubmission.md +docs/Model/Grade.md +docs/Model/Group.md +docs/Model/GroupCreation.md +docs/Model/GroupDetails.md +docs/Model/GroupType.md +docs/Model/LicenseMode.md +docs/Model/LicenseSources.md +docs/Model/LmsName.md +docs/Model/LtiConfiguration.md +docs/Model/LtiConfiguration1p1.md +docs/Model/LtiConfiguration1p1AllOfTool.md +docs/Model/LtiConfiguration1p3.md +docs/Model/LtiConfiguration1p3Base.md +docs/Model/LtiConfiguration1p3BaseSupportedServices.md +docs/Model/LtiConfiguration1p3BaseSupportedServicesAgs.md +docs/Model/LtiConfiguration1p3BaseSupportedServicesDeepLinking.md +docs/Model/LtiConfiguration1p3BaseSupportedServicesNrps.md +docs/Model/LtiConfiguration1p3BaseTool.md +docs/Model/LtiConfiguration1p3Deployment.md +docs/Model/LtiConfiguration1p3Dynamic.md +docs/Model/LtiConfiguration1p3Manual.md +docs/Model/LtiConfigurationBase.md +docs/Model/LtiConfigurationCreate.md +docs/Model/LtiConfigurationCreate1p1.md +docs/Model/LtiConfigurationCreate1p3Deployment.md +docs/Model/LtiConfigurationCreate1p3Dynamic.md +docs/Model/LtiConfigurationCreate1p3DynamicPlatformInfo.md +docs/Model/LtiConfigurationCreate1p3Manual.md +docs/Model/LtiConfigurationUpdate.md +docs/Model/LtiConfigurationUpdateDeployment.md +docs/Model/LtiConfigurationUpdateStandalone.md +docs/Model/LtiCredentials.md +docs/Model/LtiCredentialsCreation.md +docs/Model/MediaAttachment.md +docs/Model/MediaScoreSharingMode.md +docs/Model/MicrosoftGraphAssignment.md +docs/Model/MicrosoftGraphSubmission.md +docs/Model/OmrCapabilities.md +docs/Model/OmrDetailsStepData.md +docs/Model/OmrDetailsSubmission.md +docs/Model/OmrDetectedInstrument.md +docs/Model/OmrImportedMetadata.md +docs/Model/OmrInstrumentOverride.md +docs/Model/OmrJob.md +docs/Model/OmrJobCreation.md +docs/Model/OmrJobFileMetadata.md +docs/Model/OmrJobFileUpload.md +docs/Model/OmrJobFileUploadResult.md +docs/Model/OmrJobInputFile.md +docs/Model/OmrJobOutput.md +docs/Model/OmrJobProgress.md +docs/Model/OmrJobResult.md +docs/Model/OmrJobRetention.md +docs/Model/OmrJobStatus.md +docs/Model/OmrLocaleDetails.md +docs/Model/OmrPendingStep.md +docs/Model/OmrStepName.md +docs/Model/OrganizationInvitation.md +docs/Model/OrganizationInvitationCreation.md +docs/Model/OrganizationRoles.md +docs/Model/OrganizationUserAccessTokenCreation.md +docs/Model/RenameGroupRequest.md +docs/Model/ResourceCollaborator.md +docs/Model/ResourceCollaboratorCreation.md +docs/Model/ResourceRights.md +docs/Model/ScoreComment.md +docs/Model/ScoreCommentContext.md +docs/Model/ScoreCommentCreation.md +docs/Model/ScoreCommentModeration.md +docs/Model/ScoreCommentUpdate.md +docs/Model/ScoreCommentsCounts.md +docs/Model/ScoreCreation.md +docs/Model/ScoreCreationBuilderData.md +docs/Model/ScoreCreationBuilderDataAllOfBuilderData.md +docs/Model/ScoreCreationBuilderDataAllOfBuilderDataLayoutData.md +docs/Model/ScoreCreationBuilderDataAllOfBuilderDataScoreData.md +docs/Model/ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments.md +docs/Model/ScoreCreationCommon.md +docs/Model/ScoreCreationFileImport.md +docs/Model/ScoreCreationGoogleDriveImport.md +docs/Model/ScoreCreationType.md +docs/Model/ScoreDetails.md +docs/Model/ScoreDetailsAllOfMe.md +docs/Model/ScoreFork.md +docs/Model/ScoreLicense.md +docs/Model/ScoreLikesCounts.md +docs/Model/ScoreModification.md +docs/Model/ScorePlaysCounts.md +docs/Model/ScorePrivacy.md +docs/Model/ScoreRevision.md +docs/Model/ScoreRevisionCreation.md +docs/Model/ScoreRevisionStatistics.md +docs/Model/ScoreSource.md +docs/Model/ScoreSummary.md +docs/Model/ScoreTrack.md +docs/Model/ScoreTrackCreation.md +docs/Model/ScoreTrackCreationResponse.md +docs/Model/ScoreTrackPoint.md +docs/Model/ScoreTrackPurpose.md +docs/Model/ScoreTrackState.md +docs/Model/ScoreTrackType.md +docs/Model/ScoreTrackUpdate.md +docs/Model/ScoreViewsCounts.md +docs/Model/Task.md +docs/Model/TaskExportOptions.md +docs/Model/TaskProgress.md +docs/Model/TaskResult.md +docs/Model/TeachingTheme.md +docs/Model/TutteoProduct.md +docs/Model/UserAdminUpdate.md +docs/Model/UserAzureDetails.md +docs/Model/UserBasics.md +docs/Model/UserCommunityProfileLinks.md +docs/Model/UserCreation.md +docs/Model/UserDetails.md +docs/Model/UserDetailsAdmin.md +docs/Model/UserDetailsAdminAllOfLicense.md +docs/Model/UserPublic.md +docs/Model/UserPublicSummary.md +docs/Model/UserSigninLink.md +docs/Model/UserSigninLinkCreation.md +git_push.sh +phpunit.xml.dist +src/Api/AccountApi.php +src/Api/ClassApi.php +src/Api/CollectionApi.php +src/Api/EduResourcesApi.php +src/Api/GroupApi.php +src/Api/OMRApi.php +src/Api/OrganizationApi.php +src/Api/ScoreApi.php +src/Api/TaskApi.php +src/Api/UserApi.php +src/ApiException.php +src/Configuration.php +src/FormDataProcessor.php +src/HeaderSelector.php +src/Model/AddGroupUser200Response.php +src/Model/AddGroupUserRequest.php +src/Model/ApiAccessToken.php +src/Model/AppScopes.php +src/Model/Assignment.php +src/Model/AssignmentCapabilities.php +src/Model/AssignmentCapabilitiesCanPublishInClassError.php +src/Model/AssignmentCopy.php +src/Model/AssignmentCopyResponse.php +src/Model/AssignmentCopyToClass.php +src/Model/AssignmentCopyToResourceLibrary.php +src/Model/AssignmentGroup.php +src/Model/AssignmentSubmission.php +src/Model/AssignmentSubmissionComment.php +src/Model/AssignmentSubmissionCommentCreation.php +src/Model/AssignmentSubmissionComments.php +src/Model/AssignmentSubmissionHistory.php +src/Model/AssignmentSubmissionHistoryAttachment.php +src/Model/AssignmentSubmissionHistoryState.php +src/Model/AssignmentSubmissionLti.php +src/Model/AssignmentSubmissionPlayback.php +src/Model/AssignmentSubmissionState.php +src/Model/AssignmentSubmissionStudentsMode.php +src/Model/AssignmentSubmissionUpdate.php +src/Model/AssignmentType.php +src/Model/AssignmentUpdate.php +src/Model/ClassAssignment.php +src/Model/ClassAssignmentAllOfCanvas.php +src/Model/ClassAssignmentAllOfLti.php +src/Model/ClassAssignmentAllOfMfc.php +src/Model/ClassAssignmentUpdate.php +src/Model/ClassAssignmentUpdateAllOfGoogleClassroom.php +src/Model/ClassAssignmentUpdateAllOfMicrosoftGraph.php +src/Model/ClassAttachmentCreation.php +src/Model/ClassCreation.php +src/Model/ClassDetails.php +src/Model/ClassDetailsCanvas.php +src/Model/ClassDetailsClever.php +src/Model/ClassDetailsGoogleClassroom.php +src/Model/ClassDetailsGoogleDrive.php +src/Model/ClassDetailsIssues.php +src/Model/ClassDetailsIssuesSyncInner.php +src/Model/ClassDetailsLti.php +src/Model/ClassDetailsMfc.php +src/Model/ClassDetailsMicrosoftGraph.php +src/Model/ClassGradeLevel.php +src/Model/ClassRoles.php +src/Model/ClassState.php +src/Model/ClassUpdate.php +src/Model/Collection.php +src/Model/CollectionApp.php +src/Model/CollectionCapabilities.php +src/Model/CollectionContents.php +src/Model/CollectionCreation.php +src/Model/CollectionModification.php +src/Model/CollectionPrivacy.php +src/Model/CollectionType.php +src/Model/CreditTransaction.php +src/Model/EduLibrary.php +src/Model/EduResource.php +src/Model/EduResourceAssignmentCreation.php +src/Model/EduResourceCapabilities.php +src/Model/EduResourceCopy.php +src/Model/EduResourceCreation.php +src/Model/EduResourceFolder.php +src/Model/EduResourceLtiLink.php +src/Model/EduResourceMove.php +src/Model/EduResourcePrivacy.php +src/Model/EduResourceResource.php +src/Model/EduResourceType.php +src/Model/EduResourceUpdate.php +src/Model/EduResourceUseInClass.php +src/Model/FlatErrorResponse.php +src/Model/GoogleClassroomCoursework.php +src/Model/GoogleClassroomSubmission.php +src/Model/Grade.php +src/Model/Group.php +src/Model/GroupCreation.php +src/Model/GroupDetails.php +src/Model/GroupType.php +src/Model/LicenseMode.php +src/Model/LicenseSources.php +src/Model/LmsName.php +src/Model/LtiConfiguration.php +src/Model/LtiConfiguration1p1.php +src/Model/LtiConfiguration1p1AllOfTool.php +src/Model/LtiConfiguration1p3.php +src/Model/LtiConfiguration1p3Base.php +src/Model/LtiConfiguration1p3BaseSupportedServices.php +src/Model/LtiConfiguration1p3BaseSupportedServicesAgs.php +src/Model/LtiConfiguration1p3BaseSupportedServicesDeepLinking.php +src/Model/LtiConfiguration1p3BaseSupportedServicesNrps.php +src/Model/LtiConfiguration1p3BaseTool.php +src/Model/LtiConfiguration1p3Deployment.php +src/Model/LtiConfiguration1p3Dynamic.php +src/Model/LtiConfiguration1p3Manual.php +src/Model/LtiConfigurationBase.php +src/Model/LtiConfigurationCreate.php +src/Model/LtiConfigurationCreate1p1.php +src/Model/LtiConfigurationCreate1p3Deployment.php +src/Model/LtiConfigurationCreate1p3Dynamic.php +src/Model/LtiConfigurationCreate1p3DynamicPlatformInfo.php +src/Model/LtiConfigurationCreate1p3Manual.php +src/Model/LtiConfigurationUpdate.php +src/Model/LtiConfigurationUpdateDeployment.php +src/Model/LtiConfigurationUpdateStandalone.php +src/Model/LtiCredentials.php +src/Model/LtiCredentialsCreation.php +src/Model/MediaAttachment.php +src/Model/MediaScoreSharingMode.php +src/Model/MicrosoftGraphAssignment.php +src/Model/MicrosoftGraphSubmission.php +src/Model/ModelInterface.php +src/Model/OmrCapabilities.php +src/Model/OmrDetailsStepData.php +src/Model/OmrDetailsSubmission.php +src/Model/OmrDetectedInstrument.php +src/Model/OmrImportedMetadata.php +src/Model/OmrInstrumentOverride.php +src/Model/OmrJob.php +src/Model/OmrJobCreation.php +src/Model/OmrJobFileMetadata.php +src/Model/OmrJobFileUpload.php +src/Model/OmrJobFileUploadResult.php +src/Model/OmrJobInputFile.php +src/Model/OmrJobOutput.php +src/Model/OmrJobProgress.php +src/Model/OmrJobResult.php +src/Model/OmrJobRetention.php +src/Model/OmrJobStatus.php +src/Model/OmrLocaleDetails.php +src/Model/OmrPendingStep.php +src/Model/OmrStepName.php +src/Model/OneOfInterface.php +src/Model/OrganizationInvitation.php +src/Model/OrganizationInvitationCreation.php +src/Model/OrganizationRoles.php +src/Model/OrganizationUserAccessTokenCreation.php +src/Model/RenameGroupRequest.php +src/Model/ResourceCollaborator.php +src/Model/ResourceCollaboratorCreation.php +src/Model/ResourceRights.php +src/Model/ScoreComment.php +src/Model/ScoreCommentContext.php +src/Model/ScoreCommentCreation.php +src/Model/ScoreCommentModeration.php +src/Model/ScoreCommentUpdate.php +src/Model/ScoreCommentsCounts.php +src/Model/ScoreCreation.php +src/Model/ScoreCreationBuilderData.php +src/Model/ScoreCreationBuilderDataAllOfBuilderData.php +src/Model/ScoreCreationBuilderDataAllOfBuilderDataLayoutData.php +src/Model/ScoreCreationBuilderDataAllOfBuilderDataScoreData.php +src/Model/ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments.php +src/Model/ScoreCreationCommon.php +src/Model/ScoreCreationFileImport.php +src/Model/ScoreCreationGoogleDriveImport.php +src/Model/ScoreCreationType.php +src/Model/ScoreDetails.php +src/Model/ScoreDetailsAllOfMe.php +src/Model/ScoreFork.php +src/Model/ScoreLicense.php +src/Model/ScoreLikesCounts.php +src/Model/ScoreModification.php +src/Model/ScorePlaysCounts.php +src/Model/ScorePrivacy.php +src/Model/ScoreRevision.php +src/Model/ScoreRevisionCreation.php +src/Model/ScoreRevisionStatistics.php +src/Model/ScoreSource.php +src/Model/ScoreSummary.php +src/Model/ScoreTrack.php +src/Model/ScoreTrackCreation.php +src/Model/ScoreTrackCreationResponse.php +src/Model/ScoreTrackPoint.php +src/Model/ScoreTrackPurpose.php +src/Model/ScoreTrackState.php +src/Model/ScoreTrackType.php +src/Model/ScoreTrackUpdate.php +src/Model/ScoreViewsCounts.php +src/Model/Task.php +src/Model/TaskExportOptions.php +src/Model/TaskProgress.php +src/Model/TaskResult.php +src/Model/TeachingTheme.php +src/Model/TutteoProduct.php +src/Model/UserAdminUpdate.php +src/Model/UserAzureDetails.php +src/Model/UserBasics.php +src/Model/UserCommunityProfileLinks.php +src/Model/UserCreation.php +src/Model/UserDetails.php +src/Model/UserDetailsAdmin.php +src/Model/UserDetailsAdminAllOfLicense.php +src/Model/UserPublic.php +src/Model/UserPublicSummary.php +src/Model/UserSigninLink.php +src/Model/UserSigninLinkCreation.php +src/ObjectSerializer.php +tests/Api/AccountApiTest.php +tests/Api/ClassApiTest.php +tests/Api/CollectionApiTest.php +tests/Api/EduResourcesApiTest.php +tests/Api/GroupApiTest.php +tests/Api/OMRApiTest.php +tests/Api/OrganizationApiTest.php +tests/Api/ScoreApiTest.php +tests/Api/TaskApiTest.php +tests/Api/UserApiTest.php +tests/Model/AddGroupUser200ResponseTest.php +tests/Model/AddGroupUserRequestTest.php +tests/Model/ApiAccessTokenTest.php +tests/Model/AppScopesTest.php +tests/Model/AssignmentCapabilitiesCanPublishInClassErrorTest.php +tests/Model/AssignmentCapabilitiesTest.php +tests/Model/AssignmentCopyResponseTest.php +tests/Model/AssignmentCopyTest.php +tests/Model/AssignmentCopyToClassTest.php +tests/Model/AssignmentCopyToResourceLibraryTest.php +tests/Model/AssignmentGroupTest.php +tests/Model/AssignmentSubmissionCommentCreationTest.php +tests/Model/AssignmentSubmissionCommentTest.php +tests/Model/AssignmentSubmissionCommentsTest.php +tests/Model/AssignmentSubmissionHistoryAttachmentTest.php +tests/Model/AssignmentSubmissionHistoryStateTest.php +tests/Model/AssignmentSubmissionHistoryTest.php +tests/Model/AssignmentSubmissionLtiTest.php +tests/Model/AssignmentSubmissionPlaybackTest.php +tests/Model/AssignmentSubmissionStateTest.php +tests/Model/AssignmentSubmissionStudentsModeTest.php +tests/Model/AssignmentSubmissionTest.php +tests/Model/AssignmentSubmissionUpdateTest.php +tests/Model/AssignmentTest.php +tests/Model/AssignmentTypeTest.php +tests/Model/AssignmentUpdateTest.php +tests/Model/ClassAssignmentAllOfCanvasTest.php +tests/Model/ClassAssignmentAllOfLtiTest.php +tests/Model/ClassAssignmentAllOfMfcTest.php +tests/Model/ClassAssignmentTest.php +tests/Model/ClassAssignmentUpdateAllOfGoogleClassroomTest.php +tests/Model/ClassAssignmentUpdateAllOfMicrosoftGraphTest.php +tests/Model/ClassAssignmentUpdateTest.php +tests/Model/ClassAttachmentCreationTest.php +tests/Model/ClassCreationTest.php +tests/Model/ClassDetailsCanvasTest.php +tests/Model/ClassDetailsCleverTest.php +tests/Model/ClassDetailsGoogleClassroomTest.php +tests/Model/ClassDetailsGoogleDriveTest.php +tests/Model/ClassDetailsIssuesSyncInnerTest.php +tests/Model/ClassDetailsIssuesTest.php +tests/Model/ClassDetailsLtiTest.php +tests/Model/ClassDetailsMfcTest.php +tests/Model/ClassDetailsMicrosoftGraphTest.php +tests/Model/ClassDetailsTest.php +tests/Model/ClassGradeLevelTest.php +tests/Model/ClassRolesTest.php +tests/Model/ClassStateTest.php +tests/Model/ClassUpdateTest.php +tests/Model/CollectionAppTest.php +tests/Model/CollectionCapabilitiesTest.php +tests/Model/CollectionContentsTest.php +tests/Model/CollectionCreationTest.php +tests/Model/CollectionModificationTest.php +tests/Model/CollectionPrivacyTest.php +tests/Model/CollectionTest.php +tests/Model/CollectionTypeTest.php +tests/Model/CreditTransactionTest.php +tests/Model/EduLibraryTest.php +tests/Model/EduResourceAssignmentCreationTest.php +tests/Model/EduResourceCapabilitiesTest.php +tests/Model/EduResourceCopyTest.php +tests/Model/EduResourceCreationTest.php +tests/Model/EduResourceFolderTest.php +tests/Model/EduResourceLtiLinkTest.php +tests/Model/EduResourceMoveTest.php +tests/Model/EduResourcePrivacyTest.php +tests/Model/EduResourceResourceTest.php +tests/Model/EduResourceTest.php +tests/Model/EduResourceTypeTest.php +tests/Model/EduResourceUpdateTest.php +tests/Model/EduResourceUseInClassTest.php +tests/Model/FlatErrorResponseTest.php +tests/Model/GoogleClassroomCourseworkTest.php +tests/Model/GoogleClassroomSubmissionTest.php +tests/Model/GradeTest.php +tests/Model/GroupCreationTest.php +tests/Model/GroupDetailsTest.php +tests/Model/GroupTest.php +tests/Model/GroupTypeTest.php +tests/Model/LicenseModeTest.php +tests/Model/LicenseSourcesTest.php +tests/Model/LmsNameTest.php +tests/Model/LtiConfiguration1p1AllOfToolTest.php +tests/Model/LtiConfiguration1p1Test.php +tests/Model/LtiConfiguration1p3BaseSupportedServicesAgsTest.php +tests/Model/LtiConfiguration1p3BaseSupportedServicesDeepLinkingTest.php +tests/Model/LtiConfiguration1p3BaseSupportedServicesNrpsTest.php +tests/Model/LtiConfiguration1p3BaseSupportedServicesTest.php +tests/Model/LtiConfiguration1p3BaseTest.php +tests/Model/LtiConfiguration1p3BaseToolTest.php +tests/Model/LtiConfiguration1p3DeploymentTest.php +tests/Model/LtiConfiguration1p3DynamicTest.php +tests/Model/LtiConfiguration1p3ManualTest.php +tests/Model/LtiConfiguration1p3Test.php +tests/Model/LtiConfigurationBaseTest.php +tests/Model/LtiConfigurationCreate1p1Test.php +tests/Model/LtiConfigurationCreate1p3DeploymentTest.php +tests/Model/LtiConfigurationCreate1p3DynamicPlatformInfoTest.php +tests/Model/LtiConfigurationCreate1p3DynamicTest.php +tests/Model/LtiConfigurationCreate1p3ManualTest.php +tests/Model/LtiConfigurationCreateTest.php +tests/Model/LtiConfigurationTest.php +tests/Model/LtiConfigurationUpdateDeploymentTest.php +tests/Model/LtiConfigurationUpdateStandaloneTest.php +tests/Model/LtiConfigurationUpdateTest.php +tests/Model/LtiCredentialsCreationTest.php +tests/Model/LtiCredentialsTest.php +tests/Model/MediaAttachmentTest.php +tests/Model/MediaScoreSharingModeTest.php +tests/Model/MicrosoftGraphAssignmentTest.php +tests/Model/MicrosoftGraphSubmissionTest.php +tests/Model/OmrCapabilitiesTest.php +tests/Model/OmrDetailsStepDataTest.php +tests/Model/OmrDetailsSubmissionTest.php +tests/Model/OmrDetectedInstrumentTest.php +tests/Model/OmrImportedMetadataTest.php +tests/Model/OmrInstrumentOverrideTest.php +tests/Model/OmrJobCreationTest.php +tests/Model/OmrJobFileMetadataTest.php +tests/Model/OmrJobFileUploadResultTest.php +tests/Model/OmrJobFileUploadTest.php +tests/Model/OmrJobInputFileTest.php +tests/Model/OmrJobOutputTest.php +tests/Model/OmrJobProgressTest.php +tests/Model/OmrJobResultTest.php +tests/Model/OmrJobRetentionTest.php +tests/Model/OmrJobStatusTest.php +tests/Model/OmrJobTest.php +tests/Model/OmrLocaleDetailsTest.php +tests/Model/OmrPendingStepTest.php +tests/Model/OmrStepNameTest.php +tests/Model/OrganizationInvitationCreationTest.php +tests/Model/OrganizationInvitationTest.php +tests/Model/OrganizationRolesTest.php +tests/Model/OrganizationUserAccessTokenCreationTest.php +tests/Model/RenameGroupRequestTest.php +tests/Model/ResourceCollaboratorCreationTest.php +tests/Model/ResourceCollaboratorTest.php +tests/Model/ResourceRightsTest.php +tests/Model/ScoreCommentContextTest.php +tests/Model/ScoreCommentCreationTest.php +tests/Model/ScoreCommentModerationTest.php +tests/Model/ScoreCommentTest.php +tests/Model/ScoreCommentUpdateTest.php +tests/Model/ScoreCommentsCountsTest.php +tests/Model/ScoreCreationBuilderDataAllOfBuilderDataLayoutDataTest.php +tests/Model/ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstrumentsTest.php +tests/Model/ScoreCreationBuilderDataAllOfBuilderDataScoreDataTest.php +tests/Model/ScoreCreationBuilderDataAllOfBuilderDataTest.php +tests/Model/ScoreCreationBuilderDataTest.php +tests/Model/ScoreCreationCommonTest.php +tests/Model/ScoreCreationFileImportTest.php +tests/Model/ScoreCreationGoogleDriveImportTest.php +tests/Model/ScoreCreationTest.php +tests/Model/ScoreCreationTypeTest.php +tests/Model/ScoreDetailsAllOfMeTest.php +tests/Model/ScoreDetailsTest.php +tests/Model/ScoreForkTest.php +tests/Model/ScoreLicenseTest.php +tests/Model/ScoreLikesCountsTest.php +tests/Model/ScoreModificationTest.php +tests/Model/ScorePlaysCountsTest.php +tests/Model/ScorePrivacyTest.php +tests/Model/ScoreRevisionCreationTest.php +tests/Model/ScoreRevisionStatisticsTest.php +tests/Model/ScoreRevisionTest.php +tests/Model/ScoreSourceTest.php +tests/Model/ScoreSummaryTest.php +tests/Model/ScoreTrackCreationResponseTest.php +tests/Model/ScoreTrackCreationTest.php +tests/Model/ScoreTrackPointTest.php +tests/Model/ScoreTrackPurposeTest.php +tests/Model/ScoreTrackStateTest.php +tests/Model/ScoreTrackTest.php +tests/Model/ScoreTrackTypeTest.php +tests/Model/ScoreTrackUpdateTest.php +tests/Model/ScoreViewsCountsTest.php +tests/Model/TaskExportOptionsTest.php +tests/Model/TaskProgressTest.php +tests/Model/TaskResultTest.php +tests/Model/TaskTest.php +tests/Model/TeachingThemeTest.php +tests/Model/TutteoProductTest.php +tests/Model/UserAdminUpdateTest.php +tests/Model/UserAzureDetailsTest.php +tests/Model/UserBasicsTest.php +tests/Model/UserCommunityProfileLinksTest.php +tests/Model/UserCreationTest.php +tests/Model/UserDetailsAdminAllOfLicenseTest.php +tests/Model/UserDetailsAdminTest.php +tests/Model/UserDetailsTest.php +tests/Model/UserPublicSummaryTest.php +tests/Model/UserPublicTest.php +tests/Model/UserSigninLinkCreationTest.php +tests/Model/UserSigninLinkTest.php diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 0000000..0783219 --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.24.0 diff --git a/.php_cs b/.php_cs deleted file mode 100644 index 6b8e23c..0000000 --- a/.php_cs +++ /dev/null @@ -1,18 +0,0 @@ -level(Symfony\CS\FixerInterface::PSR2_LEVEL) - ->setUsingCache(true) - ->fixers( - [ - 'ordered_use', - 'phpdoc_order', - 'short_array_syntax', - 'strict', - 'strict_param' - ] - ) - ->finder( - Symfony\CS\Finder\DefaultFinder::create() - ->in(__DIR__) - ); diff --git a/.sdkgen.yaml b/.sdkgen.yaml new file mode 100644 index 0000000..e547210 --- /dev/null +++ b/.sdkgen.yaml @@ -0,0 +1,33 @@ +schema_version: 1 + +language: php +package_name: flat/api +registry: packagist + +generator: + name: php-nextgen + version: 7.24.0 + config: tools/openapi-config.json + +generated_paths: + - src/** + - docs/reference/** + - .openapi-generator/** + - OPERATIONS.json + +# Packagist reads the version from the git tag, so composer.json carries no version field. +# VERSION is the source of truth (as it is for every SDK here). +version_file: + path: VERSION + pattern: '^(?P[0-9]+\.[0-9]+\.[0-9]+)$' + +runtime_matrix: + - version: '8.2' + upstream_eol: 2026-12-31 + - version: '8.3' + upstream_eol: 2027-12-31 + - version: '8.4' + upstream_eol: 2028-12-31 + +smoke: + entrypoint: tools/smoke.php diff --git a/.swagger-codegen/VERSION b/.swagger-codegen/VERSION deleted file mode 100644 index 855ff95..0000000 --- a/.swagger-codegen/VERSION +++ /dev/null @@ -1 +0,0 @@ -2.4.0-SNAPSHOT \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8a93978..0000000 --- a/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: php -sudo: false -php: - - 5.6 - - 7.0 - - 7.1 - #- hhvm -before_install: "composer install" -script: "vendor/bin/phpunit" diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c76c47..ae16ed8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## [1.0.0](https://github.com/FlatIO/api-client-php/compare/v0.8.2...v1.0.0) (2026-09-11) + +The first stable release of the 1.x line. Regenerated against API specification 2.26.1, covering +all 123 public operations. See [MIGRATION.md](MIGRATION.md) for the upgrade from 0.x. + +### Features + +* Typed errors: an API failure throws `FlatNotFoundError`, `FlatAuthenticationError` and the rest + of the `FlatError` hierarchy, rather than the generated `ApiException`. +* Retries with backoff, as Guzzle middleware so every request passes through it. Flat returns HTTP + 403 for rate limiting with the reset in `X-RateLimit-Reset`, so the decision reads the response + body's `code` to tell a throttle from a genuine authorization failure. +* Pagination that follows the `Link` header cursor, which the specification does not declare. +* OAuth2 with token refresh on expiry. +* `FlatClient` as a single entry point over the ten generated APIs. + +### Breaking Changes + +* Requires PHP 8.2 or later. +* Generated with php-nextgen rather than swagger-codegen, so names and namespaces have changed. + ## 0.8.2 * Rebuild with Swagger 2.4.0-20180421.065846-237 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8dada3e --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/MIGRATION.md b/MIGRATION.md new file mode 100644 index 0000000..dfeae32 --- /dev/null +++ b/MIGRATION.md @@ -0,0 +1,47 @@ +# Migrating to 1.0.0 + +Version 1.0.0 is the first stable release of this client and a full regeneration against the +current Flat API. The package was previously below 1.0, so this is the point at which it starts +making a compatibility promise. The previous +release line (0.6.x) was generated in 2024 or earlier and is missing everything the API has +shipped since. + +The previous major stays installable and is deprecated on Packagist, not withdrawn. Nothing breaks +until you choose to upgrade. + +## Why upgrade + +- **Complete API coverage.** All 123 public operations, verified automatically on every release. + The old client predates a great deal of the API, including OMR. +- **It stays current.** Releases are now automatic, tied to specification releases. +- **Typed errors, retries, pagination and OAuth refresh**, none of which the old client had. +- **Modern runtimes and full type information.** + +## What breaks + +1. **Package layout changed.** Import from the package root rather than reaching into internals. +2. **Errors are typed.** Code that inspected status codes or parsed message strings should branch on + the error class instead. Note that rate limiting is HTTP 403, not 429. +3. **Supported runtimes moved up** to PHP 8.2, 8.3 and 8.4. End-of-life runtimes are no longer supported. +4. **Manual pagination is unnecessary.** Hand-rolled cursor loops still work, but the built-in + iterator is correct in cases hand-rolled loops usually miss. +5. **Model names follow the specification.** A few renames follow schema names upstream. + +## How to upgrade + +1. Raise your runtime to a supported version. +2. Bump the dependency: `composer require flat/api`. +3. Replace status-code checks with typed error handling. +4. Replace manual paging loops with the built-in iterator. +5. Run your tests. Anything unresolved is likely a model rename; check + [the reference](docs/reference/). + +## Staying on 0.6.x + +It keeps working and stays installable. It will not receive new API capability, and it is not +regenerated when the API changes. If you need something added to the API after early 2024, you need +1.0.0. + +## Problems + +Open an issue on this repository, or email developers@flat.io. diff --git a/OPERATIONS.json b/OPERATIONS.json new file mode 100644 index 0000000..b801f0a --- /dev/null +++ b/OPERATIONS.json @@ -0,0 +1,1219 @@ +{ + "schema_version": 1, + "spec_version": "2.26.1", + "generator": { + "name": "php-nextgen", + "version": "7.24.0" + }, + "operations": [ + { + "operation_id": "activateClass", + "method": "post", + "path": "/classes/{class}/activate", + "symbol": "ClassApi.activateClass", + "paginated": false, + "documented": true + }, + { + "operation_id": "addClassUser", + "method": "put", + "path": "/classes/{class}/users/{user}", + "symbol": "ClassApi.addClassUser", + "paginated": false, + "documented": true + }, + { + "operation_id": "addGroupUser", + "method": "post", + "path": "/groups/{group}/users", + "symbol": "GroupApi.addGroupUser", + "paginated": false, + "documented": true + }, + { + "operation_id": "addOmrJobFile", + "method": "post", + "path": "/omr/jobs/{job}/files", + "symbol": "OMRApi.addOmrJobFile", + "paginated": false, + "documented": true + }, + { + "operation_id": "addScoreCollaborator", + "method": "post", + "path": "/scores/{score}/collaborators", + "symbol": "ScoreApi.addScoreCollaborator", + "paginated": false, + "documented": true + }, + { + "operation_id": "addScoreToCollection", + "method": "put", + "path": "/collections/{collection}/scores/{score}", + "symbol": "CollectionApi.addScoreToCollection", + "paginated": false, + "documented": true + }, + { + "operation_id": "addScoreTrack", + "method": "post", + "path": "/scores/{score}/tracks", + "symbol": "ScoreApi.addScoreTrack", + "paginated": false, + "documented": true + }, + { + "operation_id": "archiveAssignment", + "method": "post", + "path": "/classes/{class}/assignments/{assignment}/archive", + "symbol": "ClassApi.archiveAssignment", + "paginated": false, + "documented": true + }, + { + "operation_id": "archiveClass", + "method": "post", + "path": "/classes/{class}/archive", + "symbol": "ClassApi.archiveClass", + "paginated": false, + "documented": true + }, + { + "operation_id": "cancelOmrJob", + "method": "post", + "path": "/omr/jobs/{job}/cancel", + "symbol": "OMRApi.cancelOmrJob", + "paginated": false, + "documented": true + }, + { + "operation_id": "copyAssignment", + "method": "post", + "path": "/classes/{class}/assignments/{assignment}/copy", + "symbol": "ClassApi.copyAssignment", + "paginated": false, + "documented": true + }, + { + "operation_id": "copyEduResource", + "method": "post", + "path": "/eduResources/{resource}/copy", + "symbol": "EduResourcesApi.copyEduResource", + "paginated": false, + "documented": true + }, + { + "operation_id": "copyEduResourceToDemoClass", + "method": "post", + "path": "/eduResources/{resource}/copyToDemoClass", + "symbol": "EduResourcesApi.copyEduResourceToDemoClass", + "paginated": false, + "documented": true + }, + { + "operation_id": "countOrgaUsers", + "method": "get", + "path": "/organizations/users/count", + "symbol": "OrganizationApi.countOrgaUsers", + "paginated": false, + "documented": true + }, + { + "operation_id": "createClass", + "method": "post", + "path": "/classes", + "symbol": "ClassApi.createClass", + "paginated": false, + "documented": true + }, + { + "operation_id": "createClassAssignment", + "method": "post", + "path": "/classes/{class}/assignments", + "symbol": "ClassApi.createClassAssignment", + "paginated": false, + "documented": true + }, + { + "operation_id": "createCollection", + "method": "post", + "path": "/collections", + "symbol": "CollectionApi.createCollection", + "paginated": false, + "documented": true + }, + { + "operation_id": "createEduResource", + "method": "post", + "path": "/eduResources", + "symbol": "EduResourcesApi.createEduResource", + "paginated": false, + "documented": true + }, + { + "operation_id": "createEduResourceLtiLink", + "method": "post", + "path": "/eduResources/{resource}/createLtiLink", + "symbol": "EduResourcesApi.createEduResourceLtiLink", + "paginated": false, + "documented": true + }, + { + "operation_id": "createExportTask", + "method": "post", + "path": "/scores/{score}/revisions/{revision}/{format}/task", + "symbol": "ScoreApi.createExportTask", + "paginated": false, + "documented": true + }, + { + "operation_id": "createGroup", + "method": "post", + "path": "/groups", + "symbol": "GroupApi.createGroup", + "paginated": false, + "documented": true + }, + { + "operation_id": "createLtiConfiguration", + "method": "post", + "path": "/organizations/lti/configurations", + "symbol": "OrganizationApi.createLtiConfiguration", + "paginated": false, + "documented": true + }, + { + "operation_id": "createLtiCredentials", + "method": "post", + "path": "/organizations/lti/credentials", + "symbol": "OrganizationApi.createLtiCredentials", + "paginated": false, + "documented": true + }, + { + "operation_id": "createOmrJob", + "method": "post", + "path": "/omr/jobs", + "symbol": "OMRApi.createOmrJob", + "paginated": false, + "documented": true + }, + { + "operation_id": "createOrganizationInvitation", + "method": "post", + "path": "/organizations/invitations", + "symbol": "OrganizationApi.createOrganizationInvitation", + "paginated": false, + "documented": true + }, + { + "operation_id": "createOrganizationUser", + "method": "post", + "path": "/organizations/users", + "symbol": "OrganizationApi.createOrganizationUser", + "paginated": false, + "documented": true + }, + { + "operation_id": "createOrganizationUserAccessToken", + "method": "post", + "path": "/organizations/users/{user}/accessToken", + "symbol": "OrganizationApi.createOrganizationUserAccessToken", + "paginated": false, + "documented": true + }, + { + "operation_id": "createOrganizationUserSigninLink", + "method": "post", + "path": "/organizations/users/{user}/signinLink", + "symbol": "OrganizationApi.createOrganizationUserSigninLink", + "paginated": false, + "documented": true + }, + { + "operation_id": "createScore", + "method": "post", + "path": "/scores", + "symbol": "ScoreApi.createScore", + "paginated": false, + "documented": true + }, + { + "operation_id": "createScoreRevision", + "method": "post", + "path": "/scores/{score}/revisions", + "symbol": "ScoreApi.createScoreRevision", + "paginated": false, + "documented": true + }, + { + "operation_id": "createSubmission", + "method": "put", + "path": "/classes/{class}/assignments/{assignment}/submissions", + "symbol": "ClassApi.createSubmission", + "paginated": false, + "documented": true + }, + { + "operation_id": "createTestStudentAccount", + "method": "post", + "path": "/classes/{class}/testStudent", + "symbol": "ClassApi.createTestStudentAccount", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteAssignment", + "method": "delete", + "path": "/classes/{class}/assignments/{assignment}", + "symbol": "ClassApi.deleteAssignment", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteClassUser", + "method": "delete", + "path": "/classes/{class}/users/{user}", + "symbol": "ClassApi.deleteClassUser", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteCollection", + "method": "delete", + "path": "/collections/{collection}", + "symbol": "CollectionApi.deleteCollection", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteEduResource", + "method": "delete", + "path": "/eduResources/{resource}", + "symbol": "EduResourcesApi.deleteEduResource", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteGroup", + "method": "delete", + "path": "/groups/{group}", + "symbol": "GroupApi.deleteGroup", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteLtiConfiguration", + "method": "delete", + "path": "/organizations/lti/configurations/{configuration}", + "symbol": "OrganizationApi.deleteLtiConfiguration", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteOmrJob", + "method": "delete", + "path": "/omr/jobs/{job}", + "symbol": "OMRApi.deleteOmrJob", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteScore", + "method": "delete", + "path": "/scores/{score}", + "symbol": "ScoreApi.deleteScore", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteScoreComment", + "method": "delete", + "path": "/scores/{score}/comments/{comment}", + "symbol": "ScoreApi.deleteScoreComment", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteScoreFromCollection", + "method": "delete", + "path": "/collections/{collection}/scores/{score}", + "symbol": "CollectionApi.deleteScoreFromCollection", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteScoreTrack", + "method": "delete", + "path": "/scores/{score}/tracks/{track}", + "symbol": "ScoreApi.deleteScoreTrack", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteSubmission", + "method": "delete", + "path": "/classes/{class}/assignments/{assignment}/submissions/{submission}", + "symbol": "ClassApi.deleteSubmission", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteSubmissionComment", + "method": "delete", + "path": "/classes/{class}/assignments/{assignment}/submissions/{submission}/comments/{comment}", + "symbol": "ClassApi.deleteSubmissionComment", + "paginated": false, + "documented": true + }, + { + "operation_id": "editCollection", + "method": "put", + "path": "/collections/{collection}", + "symbol": "CollectionApi.editCollection", + "paginated": false, + "documented": true + }, + { + "operation_id": "editScore", + "method": "put", + "path": "/scores/{score}", + "symbol": "ScoreApi.editScore", + "paginated": false, + "documented": true + }, + { + "operation_id": "editSubmission", + "method": "put", + "path": "/classes/{class}/assignments/{assignment}/submissions/{submission}", + "symbol": "ClassApi.editSubmission", + "paginated": false, + "documented": true + }, + { + "operation_id": "enrollClass", + "method": "post", + "path": "/classes/enroll/{enrollmentCode}", + "symbol": "ClassApi.enrollClass", + "paginated": false, + "documented": true + }, + { + "operation_id": "exportSubmissionsReviewsAsCsv", + "method": "get", + "path": "/classes/{class}/assignments/{assignment}/submissions/csv", + "symbol": "ClassApi.exportSubmissionsReviewsAsCsv", + "paginated": false, + "documented": true + }, + { + "operation_id": "exportSubmissionsReviewsAsExcel", + "method": "get", + "path": "/classes/{class}/assignments/{assignment}/submissions/excel", + "symbol": "ClassApi.exportSubmissionsReviewsAsExcel", + "paginated": false, + "documented": true + }, + { + "operation_id": "forkScore", + "method": "post", + "path": "/scores/{score}/fork", + "symbol": "ScoreApi.forkScore", + "paginated": false, + "documented": true + }, + { + "operation_id": "getAssignment", + "method": "get", + "path": "/classes/{class}/assignments/{assignment}", + "symbol": "ClassApi.getAssignment", + "paginated": false, + "documented": true + }, + { + "operation_id": "getAuthenticatedUser", + "method": "get", + "path": "/me", + "symbol": "AccountApi.getAuthenticatedUser", + "paginated": false, + "documented": true + }, + { + "operation_id": "getClass", + "method": "get", + "path": "/classes/{class}", + "symbol": "ClassApi.getClass", + "paginated": false, + "documented": true + }, + { + "operation_id": "getCollection", + "method": "get", + "path": "/collections/{collection}", + "symbol": "CollectionApi.getCollection", + "paginated": false, + "documented": true + }, + { + "operation_id": "getEduResource", + "method": "get", + "path": "/eduResources/{resource}", + "symbol": "EduResourcesApi.getEduResource", + "paginated": false, + "documented": true + }, + { + "operation_id": "getGroupDetails", + "method": "get", + "path": "/groups/{group}", + "symbol": "GroupApi.getGroupDetails", + "paginated": false, + "documented": true + }, + { + "operation_id": "getGroupScores", + "method": "get", + "path": "/groups/{group}/scores", + "symbol": "GroupApi.getGroupScores", + "paginated": false, + "documented": true + }, + { + "operation_id": "getOmrCapabilities", + "method": "get", + "path": "/omr/capabilities", + "symbol": "OMRApi.getOmrCapabilities", + "paginated": false, + "documented": true + }, + { + "operation_id": "getOmrJob", + "method": "get", + "path": "/omr/jobs/{job}", + "symbol": "OMRApi.getOmrJob", + "paginated": false, + "documented": true + }, + { + "operation_id": "getOmrJobExport", + "method": "get", + "path": "/omr/jobs/{job}/exports/{format}", + "symbol": "OMRApi.getOmrJobExport", + "paginated": false, + "documented": true + }, + { + "operation_id": "getOmrJobFile", + "method": "get", + "path": "/omr/jobs/{job}/files/{index}", + "symbol": "OMRApi.getOmrJobFile", + "paginated": false, + "documented": true + }, + { + "operation_id": "getScore", + "method": "get", + "path": "/scores/{score}", + "symbol": "ScoreApi.getScore", + "paginated": false, + "documented": true + }, + { + "operation_id": "getScoreCollaborator", + "method": "get", + "path": "/scores/{score}/collaborators/{collaborator}", + "symbol": "ScoreApi.getScoreCollaborator", + "paginated": false, + "documented": true + }, + { + "operation_id": "getScoreCollaborators", + "method": "get", + "path": "/scores/{score}/collaborators", + "symbol": "ScoreApi.getScoreCollaborators", + "paginated": false, + "documented": true + }, + { + "operation_id": "getScoreComments", + "method": "get", + "path": "/scores/{score}/comments", + "symbol": "ScoreApi.getScoreComments", + "paginated": false, + "documented": true + }, + { + "operation_id": "getScoreRevision", + "method": "get", + "path": "/scores/{score}/revisions/{revision}", + "symbol": "ScoreApi.getScoreRevision", + "paginated": false, + "documented": true + }, + { + "operation_id": "getScoreRevisionData", + "method": "get", + "path": "/scores/{score}/revisions/{revision}/{format}", + "symbol": "ScoreApi.getScoreRevisionData", + "paginated": false, + "documented": true + }, + { + "operation_id": "getScoreRevisions", + "method": "get", + "path": "/scores/{score}/revisions", + "symbol": "ScoreApi.getScoreRevisions", + "paginated": false, + "documented": true + }, + { + "operation_id": "getScoreSubmissions", + "method": "get", + "path": "/scores/{score}/submissions", + "symbol": "ClassApi.getScoreSubmissions", + "paginated": false, + "documented": true + }, + { + "operation_id": "getScoreTrack", + "method": "get", + "path": "/scores/{score}/tracks/{track}", + "symbol": "ScoreApi.getScoreTrack", + "paginated": false, + "documented": true + }, + { + "operation_id": "getSubmission", + "method": "get", + "path": "/classes/{class}/assignments/{assignment}/submissions/{submission}", + "symbol": "ClassApi.getSubmission", + "paginated": false, + "documented": true + }, + { + "operation_id": "getSubmissionComments", + "method": "get", + "path": "/classes/{class}/assignments/{assignment}/submissions/{submission}/comments", + "symbol": "ClassApi.getSubmissionComments", + "paginated": false, + "documented": true + }, + { + "operation_id": "getSubmissionHistory", + "method": "get", + "path": "/classes/{class}/assignments/{assignment}/submissions/{submission}/history", + "symbol": "ClassApi.getSubmissionHistory", + "paginated": false, + "documented": true + }, + { + "operation_id": "getSubmissions", + "method": "get", + "path": "/classes/{class}/assignments/{assignment}/submissions", + "symbol": "ClassApi.getSubmissions", + "paginated": false, + "documented": true + }, + { + "operation_id": "getTask", + "method": "get", + "path": "/tasks/{task}", + "symbol": "TaskApi.getTask", + "paginated": false, + "documented": true + }, + { + "operation_id": "getUser", + "method": "get", + "path": "/users/{user}", + "symbol": "UserApi.getUser", + "paginated": false, + "documented": true + }, + { + "operation_id": "getUserLikes", + "method": "get", + "path": "/users/{user}/likes", + "symbol": "UserApi.getUserLikes", + "paginated": true, + "documented": true + }, + { + "operation_id": "getUserScores", + "method": "get", + "path": "/users/{user}/scores", + "symbol": "UserApi.getUserScores", + "paginated": true, + "documented": true + }, + { + "operation_id": "listAssignments", + "method": "get", + "path": "/classes/{class}/assignments", + "symbol": "ClassApi.listAssignments", + "paginated": false, + "documented": true + }, + { + "operation_id": "listBillingCreditsHistory", + "method": "get", + "path": "/billing/credits/history", + "symbol": "OMRApi.listBillingCreditsHistory", + "paginated": true, + "documented": true + }, + { + "operation_id": "listClassStudentSubmissions", + "method": "get", + "path": "/classes/{class}/students/{user}/submissions", + "symbol": "ClassApi.listClassStudentSubmissions", + "paginated": false, + "documented": true + }, + { + "operation_id": "listClasses", + "method": "get", + "path": "/classes", + "symbol": "ClassApi.listClasses", + "paginated": false, + "documented": true + }, + { + "operation_id": "listCollectionScores", + "method": "get", + "path": "/collections/{collection}/scores", + "symbol": "CollectionApi.listCollectionScores", + "paginated": true, + "documented": true + }, + { + "operation_id": "listCollections", + "method": "get", + "path": "/collections", + "symbol": "CollectionApi.listCollections", + "paginated": true, + "documented": true + }, + { + "operation_id": "listEduLibraries", + "method": "get", + "path": "/eduResources/libraries", + "symbol": "EduResourcesApi.listEduLibraries", + "paginated": false, + "documented": true + }, + { + "operation_id": "listEduResources", + "method": "get", + "path": "/eduResources", + "symbol": "EduResourcesApi.listEduResources", + "paginated": true, + "documented": true + }, + { + "operation_id": "listGroupUsers", + "method": "get", + "path": "/groups/{group}/users", + "symbol": "GroupApi.listGroupUsers", + "paginated": false, + "documented": true + }, + { + "operation_id": "listGroups", + "method": "get", + "path": "/groups", + "symbol": "GroupApi.listGroups", + "paginated": false, + "documented": false + }, + { + "operation_id": "listLtiConfigurations", + "method": "get", + "path": "/organizations/lti/configurations", + "symbol": "OrganizationApi.listLtiConfigurations", + "paginated": false, + "documented": true + }, + { + "operation_id": "listLtiCredentials", + "method": "get", + "path": "/organizations/lti/credentials", + "symbol": "OrganizationApi.listLtiCredentials", + "paginated": false, + "documented": true + }, + { + "operation_id": "listOmrJobs", + "method": "get", + "path": "/omr/jobs", + "symbol": "OMRApi.listOmrJobs", + "paginated": true, + "documented": true + }, + { + "operation_id": "listOrganizationInvitations", + "method": "get", + "path": "/organizations/invitations", + "symbol": "OrganizationApi.listOrganizationInvitations", + "paginated": true, + "documented": true + }, + { + "operation_id": "listOrganizationUsers", + "method": "get", + "path": "/organizations/users", + "symbol": "OrganizationApi.listOrganizationUsers", + "paginated": true, + "documented": true + }, + { + "operation_id": "listScoreTracks", + "method": "get", + "path": "/scores/{score}/tracks", + "symbol": "ScoreApi.listScoreTracks", + "paginated": false, + "documented": true + }, + { + "operation_id": "markScoreCommentResolved", + "method": "put", + "path": "/scores/{score}/comments/{comment}/resolved", + "symbol": "ScoreApi.markScoreCommentResolved", + "paginated": false, + "documented": true + }, + { + "operation_id": "markScoreCommentUnresolved", + "method": "delete", + "path": "/scores/{score}/comments/{comment}/resolved", + "symbol": "ScoreApi.markScoreCommentUnresolved", + "paginated": false, + "documented": true + }, + { + "operation_id": "moveEduResource", + "method": "post", + "path": "/eduResources/{resource}/move", + "symbol": "EduResourcesApi.moveEduResource", + "paginated": false, + "documented": true + }, + { + "operation_id": "postScoreComment", + "method": "post", + "path": "/scores/{score}/comments", + "symbol": "ScoreApi.postScoreComment", + "paginated": false, + "documented": true + }, + { + "operation_id": "postSubmissionComment", + "method": "post", + "path": "/classes/{class}/assignments/{assignment}/submissions/{submission}/comments", + "symbol": "ClassApi.postSubmissionComment", + "paginated": false, + "documented": true + }, + { + "operation_id": "removeGroupUser", + "method": "delete", + "path": "/groups/{group}/users/{user}", + "symbol": "GroupApi.removeGroupUser", + "paginated": false, + "documented": true + }, + { + "operation_id": "removeOrganizationInvitation", + "method": "delete", + "path": "/organizations/invitations/{invitation}", + "symbol": "OrganizationApi.removeOrganizationInvitation", + "paginated": false, + "documented": true + }, + { + "operation_id": "removeOrganizationUser", + "method": "delete", + "path": "/organizations/users/{user}", + "symbol": "OrganizationApi.removeOrganizationUser", + "paginated": false, + "documented": true + }, + { + "operation_id": "removeScoreCollaborator", + "method": "delete", + "path": "/scores/{score}/collaborators/{collaborator}", + "symbol": "ScoreApi.removeScoreCollaborator", + "paginated": false, + "documented": true + }, + { + "operation_id": "renameGroup", + "method": "put", + "path": "/groups/{group}", + "symbol": "GroupApi.renameGroup", + "paginated": false, + "documented": true + }, + { + "operation_id": "revokeLtiCredentials", + "method": "delete", + "path": "/organizations/lti/credentials/{credentials}", + "symbol": "OrganizationApi.revokeLtiCredentials", + "paginated": false, + "documented": true + }, + { + "operation_id": "startOmrJob", + "method": "post", + "path": "/omr/jobs/{job}/start", + "symbol": "OMRApi.startOmrJob", + "paginated": false, + "documented": true + }, + { + "operation_id": "submitOmrJobStep", + "method": "post", + "path": "/omr/jobs/{job}/steps/{step}", + "symbol": "OMRApi.submitOmrJobStep", + "paginated": false, + "documented": true + }, + { + "operation_id": "unarchiveAssignment", + "method": "delete", + "path": "/classes/{class}/assignments/{assignment}/archive", + "symbol": "ClassApi.unarchiveAssignment", + "paginated": false, + "documented": true + }, + { + "operation_id": "unarchiveClass", + "method": "delete", + "path": "/classes/{class}/archive", + "symbol": "ClassApi.unarchiveClass", + "paginated": false, + "documented": true + }, + { + "operation_id": "untrashCollection", + "method": "post", + "path": "/collections/{collection}/untrash", + "symbol": "CollectionApi.untrashCollection", + "paginated": false, + "documented": true + }, + { + "operation_id": "untrashScore", + "method": "post", + "path": "/scores/{score}/untrash", + "symbol": "ScoreApi.untrashScore", + "paginated": false, + "documented": true + }, + { + "operation_id": "updateClass", + "method": "put", + "path": "/classes/{class}", + "symbol": "ClassApi.updateClass", + "paginated": false, + "documented": true + }, + { + "operation_id": "updateClassAssignment", + "method": "put", + "path": "/classes/{class}/assignments/{assignment}", + "symbol": "ClassApi.updateClassAssignment", + "paginated": false, + "documented": true + }, + { + "operation_id": "updateEduResource", + "method": "put", + "path": "/eduResources/{resource}", + "symbol": "EduResourcesApi.updateEduResource", + "paginated": false, + "documented": true + }, + { + "operation_id": "updateEduResourceAssignment", + "method": "put", + "path": "/eduResources/{resource}/assignment", + "symbol": "EduResourcesApi.updateEduResourceAssignment", + "paginated": false, + "documented": true + }, + { + "operation_id": "updateLtiConfiguration", + "method": "put", + "path": "/organizations/lti/configurations/{configuration}", + "symbol": "OrganizationApi.updateLtiConfiguration", + "paginated": false, + "documented": true + }, + { + "operation_id": "updateOrganizationUser", + "method": "put", + "path": "/organizations/users/{user}", + "symbol": "OrganizationApi.updateOrganizationUser", + "paginated": false, + "documented": true + }, + { + "operation_id": "updateScoreComment", + "method": "put", + "path": "/scores/{score}/comments/{comment}", + "symbol": "ScoreApi.updateScoreComment", + "paginated": false, + "documented": true + }, + { + "operation_id": "updateScoreTrack", + "method": "put", + "path": "/scores/{score}/tracks/{track}", + "symbol": "ScoreApi.updateScoreTrack", + "paginated": false, + "documented": true + }, + { + "operation_id": "updateSubmissionComment", + "method": "put", + "path": "/classes/{class}/assignments/{assignment}/submissions/{submission}/comments/{comment}", + "symbol": "ClassApi.updateSubmissionComment", + "paginated": false, + "documented": true + }, + { + "operation_id": "useEduResourceInClass", + "method": "post", + "path": "/eduResources/{resource}/useInClass", + "symbol": "EduResourcesApi.useEduResourceInClass", + "paginated": false, + "documented": true + } + ], + "models": [ + "AddGroupUser200Response", + "AddGroupUserRequest", + "ApiAccessToken", + "AppScopes", + "Assignment", + "AssignmentCapabilities", + "AssignmentCapabilitiesCanPublishInClassError", + "AssignmentCopy", + "AssignmentCopyResponse", + "AssignmentCopyToClass", + "AssignmentCopyToResourceLibrary", + "AssignmentGroup", + "AssignmentSubmission", + "AssignmentSubmissionComment", + "AssignmentSubmissionCommentCreation", + "AssignmentSubmissionComments", + "AssignmentSubmissionHistory", + "AssignmentSubmissionHistoryAttachment", + "AssignmentSubmissionHistoryState", + "AssignmentSubmissionLti", + "AssignmentSubmissionPlayback", + "AssignmentSubmissionState", + "AssignmentSubmissionStudentsMode", + "AssignmentSubmissionUpdate", + "AssignmentType", + "AssignmentUpdate", + "ClassAssignment", + "ClassAssignmentAllOfCanvas", + "ClassAssignmentAllOfLti", + "ClassAssignmentAllOfMfc", + "ClassAssignmentUpdate", + "ClassAssignmentUpdateAllOfGoogleClassroom", + "ClassAssignmentUpdateAllOfMicrosoftGraph", + "ClassAttachmentCreation", + "ClassCreation", + "ClassDetails", + "ClassDetailsCanvas", + "ClassDetailsClever", + "ClassDetailsGoogleClassroom", + "ClassDetailsGoogleDrive", + "ClassDetailsIssues", + "ClassDetailsIssuesSyncInner", + "ClassDetailsLti", + "ClassDetailsMfc", + "ClassDetailsMicrosoftGraph", + "ClassGradeLevel", + "ClassRoles", + "ClassState", + "ClassUpdate", + "Collection", + "CollectionApp", + "CollectionCapabilities", + "CollectionContents", + "CollectionCreation", + "CollectionModification", + "CollectionPrivacy", + "CollectionType", + "CreditTransaction", + "EduLibrary", + "EduResource", + "EduResourceAssignmentCreation", + "EduResourceCapabilities", + "EduResourceCopy", + "EduResourceCreation", + "EduResourceFolder", + "EduResourceLtiLink", + "EduResourceMove", + "EduResourcePrivacy", + "EduResourceResource", + "EduResourceType", + "EduResourceUpdate", + "EduResourceUseInClass", + "FlatErrorResponse", + "GoogleClassroomCoursework", + "GoogleClassroomSubmission", + "Grade", + "Group", + "GroupCreation", + "GroupDetails", + "GroupType", + "LicenseMode", + "LicenseSources", + "LmsName", + "LtiConfiguration", + "LtiConfiguration1p1", + "LtiConfiguration1p1AllOfTool", + "LtiConfiguration1p3", + "LtiConfiguration1p3Base", + "LtiConfiguration1p3BaseSupportedServices", + "LtiConfiguration1p3BaseSupportedServicesAgs", + "LtiConfiguration1p3BaseSupportedServicesDeepLinking", + "LtiConfiguration1p3BaseSupportedServicesNrps", + "LtiConfiguration1p3BaseTool", + "LtiConfiguration1p3Deployment", + "LtiConfiguration1p3Dynamic", + "LtiConfiguration1p3Manual", + "LtiConfigurationBase", + "LtiConfigurationCreate", + "LtiConfigurationCreate1p1", + "LtiConfigurationCreate1p3Deployment", + "LtiConfigurationCreate1p3Dynamic", + "LtiConfigurationCreate1p3DynamicPlatformInfo", + "LtiConfigurationCreate1p3Manual", + "LtiConfigurationUpdate", + "LtiConfigurationUpdateDeployment", + "LtiConfigurationUpdateStandalone", + "LtiCredentials", + "LtiCredentialsCreation", + "MediaAttachment", + "MediaScoreSharingMode", + "MicrosoftGraphAssignment", + "MicrosoftGraphSubmission", + "ModelInterface", + "OmrCapabilities", + "OmrDetailsStepData", + "OmrDetailsSubmission", + "OmrDetectedInstrument", + "OmrImportedMetadata", + "OmrInstrumentOverride", + "OmrJob", + "OmrJobCreation", + "OmrJobFileMetadata", + "OmrJobFileUpload", + "OmrJobFileUploadResult", + "OmrJobInputFile", + "OmrJobOutput", + "OmrJobProgress", + "OmrJobResult", + "OmrJobRetention", + "OmrJobStatus", + "OmrLocaleDetails", + "OmrPendingStep", + "OmrStepName", + "OneOfInterface", + "OrganizationInvitation", + "OrganizationInvitationCreation", + "OrganizationRoles", + "OrganizationUserAccessTokenCreation", + "RenameGroupRequest", + "ResourceCollaborator", + "ResourceCollaboratorCreation", + "ResourceRights", + "ScoreComment", + "ScoreCommentContext", + "ScoreCommentCreation", + "ScoreCommentModeration", + "ScoreCommentUpdate", + "ScoreCommentsCounts", + "ScoreCreation", + "ScoreCreationBuilderData", + "ScoreCreationBuilderDataAllOfBuilderData", + "ScoreCreationBuilderDataAllOfBuilderDataLayoutData", + "ScoreCreationBuilderDataAllOfBuilderDataScoreData", + "ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments", + "ScoreCreationCommon", + "ScoreCreationFileImport", + "ScoreCreationGoogleDriveImport", + "ScoreCreationType", + "ScoreDetails", + "ScoreDetailsAllOfMe", + "ScoreFork", + "ScoreLicense", + "ScoreLikesCounts", + "ScoreModification", + "ScorePlaysCounts", + "ScorePrivacy", + "ScoreRevision", + "ScoreRevisionCreation", + "ScoreRevisionStatistics", + "ScoreSource", + "ScoreSummary", + "ScoreTrack", + "ScoreTrackCreation", + "ScoreTrackCreationResponse", + "ScoreTrackPoint", + "ScoreTrackPurpose", + "ScoreTrackState", + "ScoreTrackType", + "ScoreTrackUpdate", + "ScoreViewsCounts", + "Task", + "TaskExportOptions", + "TaskProgress", + "TaskResult", + "TeachingTheme", + "TutteoProduct", + "UserAdminUpdate", + "UserAzureDetails", + "UserBasics", + "UserCommunityProfileLinks", + "UserCreation", + "UserDetails", + "UserDetailsAdmin", + "UserDetailsAdminAllOfLicense", + "UserPublic", + "UserPublicSummary", + "UserSigninLink", + "UserSigninLinkCreation" + ], + "scopes": [ + "account.education_profile", + "account.email", + "account.public_profile", + "collections", + "collections.add_scores", + "collections.readonly", + "edu.admin", + "edu.admin.lti", + "edu.admin.lti.readonly", + "edu.admin.users", + "edu.admin.users.readonly", + "edu.assignments", + "edu.assignments.readonly", + "edu.classes", + "edu.classes.readonly", + "edu.resources", + "edu.resources.readonly", + "notifications.readonly", + "omr", + "scores", + "scores.readonly", + "scores.social", + "tasks.readonly" + ] +} diff --git a/QUICKSTART.md b/QUICKSTART.md new file mode 100644 index 0000000..506baad --- /dev/null +++ b/QUICKSTART.md @@ -0,0 +1,65 @@ +# Quickstart + +From nothing to your first authenticated call. + +## 1. Get a token + +Create a [Personal Access Token](https://flat.io/developers/apps). It behaves like an OAuth access +token scoped to your own account, which is all you need to start. + +## 2. Install + +```sh +composer require flat/api +``` + +Requires PHP 8.2, 8.3 and 8.4. + +## 3. Call the API + +```php +use Flat\APIClient\FlatClient; + +$client = new FlatClient(accessToken: 'YOUR_TOKEN'); +echo $client->account()->getAuthenticatedUser()->getUsername(), PHP_EOL; +``` + +If that prints your account, you are done. + +## 4. Do something useful + +List your scores. The client handles paging for you: + +```php +foreach ($client->paginate('listCollections', ['parent' => 'user']) as $collection) { + echo $collection->getTitle(), PHP_EOL; +} +``` + +Each generated API is reachable by a short name: `$client->scores()`, `$client->collections()`, +`$client->classes()`, `$client->omr()`, and so on. + +## 5. Handle failure properly + +```php +try { + // ... +} catch (FlatRateLimitError $e) { + echo 'retry after ', $e->reset; +} catch (FlatNotFoundError $e) { + echo 'no such score'; +} +``` + +Two things worth knowing about the Flat API specifically: + +- Rate limiting returns **403**, not 429, and carries no `Retry-After`. The reset time is in + `X-RateLimit-Reset`. The client already handles this; the note matters if you disable retries. +- The error `id` is only present on internal and backend errors. When you have one, quote it to + support: it makes diagnosis much faster. + +## Where next + +- [README](README.md) for the full feature tour +- [Per-operation reference](docs/reference/) +- [API documentation](https://flat.io/developers/docs/api/) diff --git a/README.md b/README.md index a0be41a..15b7e37 100644 --- a/README.md +++ b/README.md @@ -1,280 +1,91 @@ -# PHP Client for the Flat REST API +# Flat API client for Php -[![Build Status](https://travis-ci.org/FlatIO/api-client-php.svg?branch=master)](https://travis-ci.org/FlatIO/api-client-php) -[![Packagist](https://img.shields.io/packagist/v/flat/api.svg)](https://packagist.org/packages/flat/api) +Official client for the [Flat REST API](https://flat.io/developers/docs/api/), generated from Flat's +public OpenAPI specification and kept current automatically. -The Flat API allows you to easily extend the abilities of the [Flat Platform](https://flat.io), with a wide range of use cases including the following: -- Creating and importing new music scores using MusicXML or MIDI files -- Browsing, updating, copying, exporting the user's scores (for example in MP3, WAV or MIDI) -- Managing educational resources with Flat for Education: creating & updating the organization accounts, the classes, rosters and assignments. - -You can find the API reference including code samples and our OpenAPI Specification at the following url: [https://flat.io/developers/api/reference](https://flat.io/developers/api/reference). - -To request some API credentials, please visit [https://flat.io/developers](https://flat.io/developers). - -This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project. - -## Requirements - -PHP 5.6.0 and later - -## Installation & Usage -### Composer +```sh +composer require flat/api +``` -To install the bindings via [Composer](http://getcomposer.org/), add the following to `composer.json`: +```php +use Flat\APIClient\FlatClient; +$client = new FlatClient(accessToken: 'YOUR_TOKEN'); +echo $client->account()->getAuthenticatedUser()->getUsername(), PHP_EOL; ``` -{ - "name": "Example Application", - "description": "This is an example using the Flat API", - "require": { - "flat/api": "dev-master" - } -} -``` +Get a token in seconds with a [Personal Access Token](https://flat.io/developers/apps); it works +exactly like an OAuth access token for your own account. -Then run `composer install` +## What this client does for you -### Manual Installation +- **Typed errors.** Branch on the error, not the status code. Flat returns HTTP 403 for both rate + limiting and authorization failures, so status alone cannot tell them apart. +- **Automatic retries.** Rate limits and server errors are retried with backoff. Flat sends no + `Retry-After`, so the client reads `X-RateLimit-Reset` instead. +- **Automatic pagination.** Eight collection endpoints are cursor-paginated with the cursor in a + `Link` header. You get an iterator; you never touch a cursor. +- **OAuth2 built in.** Authorization URLs, code exchange and transparent token refresh. +- **Full type information**, so your editor and your coding assistant both know the API. -Download the files and include `autoload.php`: +### Pagination ```php -require_once('/path/to/./vendor/autoload.php'); -``` - -## Tests - -To run the unit tests: - -``` -composer install -./vendor/bin/phpunit +foreach ($client->paginate('listCollections', ['parent' => 'user']) as $collection) { + echo $collection->getTitle(), PHP_EOL; +} ``` -## Getting Started +`paginate` takes the operation by name, with its parameters as a keyed array. It follows the +cursor for you and stops at the last page. -Please follow the [installation procedure](#installation--usage) and then run the following: +### Errors ```php -setAccessToken('YOUR_ACCESS_TOKEN'); - -$apiInstance = new Flat\APIClient\Api\AccountApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); - try { - $result = $apiInstance->getAuthenticatedUser(); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling AccountApi->getAuthenticatedUser: ', $e->getMessage(), PHP_EOL; + // ... +} catch (FlatRateLimitError $e) { + echo 'retry after ', $e->reset; +} catch (FlatNotFoundError $e) { + echo 'no such score'; } - -?> ``` -## Documentation for API Endpoints +### Asynchronous use -All URIs are relative to *https://api.flat.io/v2* +Synchronous only: async is not idiomatic in PHP for this shape of client. -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*AccountApi* | [**getAuthenticatedUser**](docs/Api/AccountApi.md#getauthenticateduser) | **GET** /me | Get current user profile -*ClassApi* | [**activateClass**](docs/Api/ClassApi.md#activateclass) | **POST** /classes/{class}/activate | Activate the class -*ClassApi* | [**addClassUser**](docs/Api/ClassApi.md#addclassuser) | **PUT** /classes/{class}/users/{user} | Add a user to the class -*ClassApi* | [**archiveClass**](docs/Api/ClassApi.md#archiveclass) | **POST** /classes/{class}/archive | Archive the class -*ClassApi* | [**copyAssignment**](docs/Api/ClassApi.md#copyassignment) | **POST** /classes/{class}/assignments/{assignment}/copy | Copy an assignment -*ClassApi* | [**createAssignment**](docs/Api/ClassApi.md#createassignment) | **POST** /classes/{class}/assignments | Assignment creation -*ClassApi* | [**createClass**](docs/Api/ClassApi.md#createclass) | **POST** /classes | Create a new class -*ClassApi* | [**createSubmission**](docs/Api/ClassApi.md#createsubmission) | **PUT** /classes/{class}/assignments/{assignment}/submissions | Create or edit a submission -*ClassApi* | [**deleteClassUser**](docs/Api/ClassApi.md#deleteclassuser) | **DELETE** /classes/{class}/users/{user} | Remove a user from the class -*ClassApi* | [**editSubmission**](docs/Api/ClassApi.md#editsubmission) | **PUT** /classes/{class}/assignments/{assignment}/submissions/{submission} | Edit a submission -*ClassApi* | [**enrollClass**](docs/Api/ClassApi.md#enrollclass) | **POST** /classes/enroll/{enrollmentCode} | Join a class -*ClassApi* | [**getClass**](docs/Api/ClassApi.md#getclass) | **GET** /classes/{class} | Get the details of a single class -*ClassApi* | [**getScoreSubmissions**](docs/Api/ClassApi.md#getscoresubmissions) | **GET** /scores/{score}/submissions | List submissions related to the score -*ClassApi* | [**getSubmission**](docs/Api/ClassApi.md#getsubmission) | **GET** /classes/{class}/assignments/{assignment}/submissions/{submission} | Get a student submission -*ClassApi* | [**getSubmissions**](docs/Api/ClassApi.md#getsubmissions) | **GET** /classes/{class}/assignments/{assignment}/submissions | List the students' submissions -*ClassApi* | [**listAssignments**](docs/Api/ClassApi.md#listassignments) | **GET** /classes/{class}/assignments | Assignments listing -*ClassApi* | [**listClassStudentSubmissions**](docs/Api/ClassApi.md#listclassstudentsubmissions) | **GET** /classes/{class}/students/{user}/submissions | List the submissions for a student -*ClassApi* | [**listClasses**](docs/Api/ClassApi.md#listclasses) | **GET** /classes | List the classes available for the current user -*ClassApi* | [**unarchiveClass**](docs/Api/ClassApi.md#unarchiveclass) | **DELETE** /classes/{class}/archive | Unarchive the class -*ClassApi* | [**updateClass**](docs/Api/ClassApi.md#updateclass) | **PUT** /classes/{class} | Update the class -*CollectionApi* | [**addScoreToCollection**](docs/Api/CollectionApi.md#addscoretocollection) | **PUT** /collections/{collection}/scores/{score} | Add a score to the collection -*CollectionApi* | [**createCollection**](docs/Api/CollectionApi.md#createcollection) | **POST** /collections | Create a new collection -*CollectionApi* | [**deleteCollection**](docs/Api/CollectionApi.md#deletecollection) | **DELETE** /collections/{collection} | Delete the collection -*CollectionApi* | [**deleteScoreFromCollection**](docs/Api/CollectionApi.md#deletescorefromcollection) | **DELETE** /collections/{collection}/scores/{score} | Delete a score from the collection -*CollectionApi* | [**editCollection**](docs/Api/CollectionApi.md#editcollection) | **PUT** /collections/{collection} | Update a collection's metadata -*CollectionApi* | [**getCollection**](docs/Api/CollectionApi.md#getcollection) | **GET** /collections/{collection} | Get collection details -*CollectionApi* | [**listCollectionScores**](docs/Api/CollectionApi.md#listcollectionscores) | **GET** /collections/{collection}/scores | List the scores contained in a collection -*CollectionApi* | [**listCollections**](docs/Api/CollectionApi.md#listcollections) | **GET** /collections | List the collections -*CollectionApi* | [**untrashCollection**](docs/Api/CollectionApi.md#untrashcollection) | **POST** /collections/{collection}/untrash | Untrash a collection -*GroupApi* | [**getGroupDetails**](docs/Api/GroupApi.md#getgroupdetails) | **GET** /groups/{group} | Get group information -*GroupApi* | [**getGroupScores**](docs/Api/GroupApi.md#getgroupscores) | **GET** /groups/{group}/scores | List group's scores -*GroupApi* | [**listGroupUsers**](docs/Api/GroupApi.md#listgroupusers) | **GET** /groups/{group}/users | List group's users -*OrganizationApi* | [**createLtiCredentials**](docs/Api/OrganizationApi.md#createlticredentials) | **POST** /organizations/lti/credentials | Create a new couple of LTI 1.x credentials -*OrganizationApi* | [**createOrganizationInvitation**](docs/Api/OrganizationApi.md#createorganizationinvitation) | **POST** /organizations/invitations | Create a new invitation to join the organization -*OrganizationApi* | [**createOrganizationUser**](docs/Api/OrganizationApi.md#createorganizationuser) | **POST** /organizations/users | Create a new user account -*OrganizationApi* | [**listLtiCredentials**](docs/Api/OrganizationApi.md#listlticredentials) | **GET** /organizations/lti/credentials | List LTI 1.x credentials -*OrganizationApi* | [**listOrganizationInvitations**](docs/Api/OrganizationApi.md#listorganizationinvitations) | **GET** /organizations/invitations | List the organization invitations -*OrganizationApi* | [**listOrganizationUsers**](docs/Api/OrganizationApi.md#listorganizationusers) | **GET** /organizations/users | List the organization users -*OrganizationApi* | [**removeOrganizationInvitation**](docs/Api/OrganizationApi.md#removeorganizationinvitation) | **DELETE** /organizations/invitations/{invitation} | Remove an organization invitation -*OrganizationApi* | [**removeOrganizationUser**](docs/Api/OrganizationApi.md#removeorganizationuser) | **DELETE** /organizations/users/{user} | Remove an account from Flat -*OrganizationApi* | [**revokeLtiCredentials**](docs/Api/OrganizationApi.md#revokelticredentials) | **DELETE** /organizations/lti/credentials/{credentials} | Revoke LTI 1.x credentials -*OrganizationApi* | [**updateOrganizationUser**](docs/Api/OrganizationApi.md#updateorganizationuser) | **PUT** /organizations/users/{user} | Update account information -*ScoreApi* | [**addScoreCollaborator**](docs/Api/ScoreApi.md#addscorecollaborator) | **POST** /scores/{score}/collaborators | Add a new collaborator -*ScoreApi* | [**addScoreTrack**](docs/Api/ScoreApi.md#addscoretrack) | **POST** /scores/{score}/tracks | Add a new video or audio track to the score -*ScoreApi* | [**createScore**](docs/Api/ScoreApi.md#createscore) | **POST** /scores | Create a new score -*ScoreApi* | [**createScoreRevision**](docs/Api/ScoreApi.md#createscorerevision) | **POST** /scores/{score}/revisions | Create a new revision -*ScoreApi* | [**deleteScore**](docs/Api/ScoreApi.md#deletescore) | **DELETE** /scores/{score} | Delete a score -*ScoreApi* | [**deleteScoreComment**](docs/Api/ScoreApi.md#deletescorecomment) | **DELETE** /scores/{score}/comments/{comment} | Delete a comment -*ScoreApi* | [**deleteScoreTrack**](docs/Api/ScoreApi.md#deletescoretrack) | **DELETE** /scores/{score}/tracks/{track} | Remove an audio or video track linked to the score -*ScoreApi* | [**editScore**](docs/Api/ScoreApi.md#editscore) | **PUT** /scores/{score} | Edit a score's metadata -*ScoreApi* | [**forkScore**](docs/Api/ScoreApi.md#forkscore) | **POST** /scores/{score}/fork | Fork a score -*ScoreApi* | [**gerUserLikes**](docs/Api/ScoreApi.md#geruserlikes) | **GET** /users/{user}/likes | List liked scores -*ScoreApi* | [**getGroupScores**](docs/Api/ScoreApi.md#getgroupscores) | **GET** /groups/{group}/scores | List group's scores -*ScoreApi* | [**getScore**](docs/Api/ScoreApi.md#getscore) | **GET** /scores/{score} | Get a score's metadata -*ScoreApi* | [**getScoreCollaborator**](docs/Api/ScoreApi.md#getscorecollaborator) | **GET** /scores/{score}/collaborators/{collaborator} | Get a collaborator -*ScoreApi* | [**getScoreCollaborators**](docs/Api/ScoreApi.md#getscorecollaborators) | **GET** /scores/{score}/collaborators | List the collaborators -*ScoreApi* | [**getScoreComments**](docs/Api/ScoreApi.md#getscorecomments) | **GET** /scores/{score}/comments | List comments -*ScoreApi* | [**getScoreRevision**](docs/Api/ScoreApi.md#getscorerevision) | **GET** /scores/{score}/revisions/{revision} | Get a score revision -*ScoreApi* | [**getScoreRevisionData**](docs/Api/ScoreApi.md#getscorerevisiondata) | **GET** /scores/{score}/revisions/{revision}/{format} | Get a score revision data -*ScoreApi* | [**getScoreRevisions**](docs/Api/ScoreApi.md#getscorerevisions) | **GET** /scores/{score}/revisions | List the revisions -*ScoreApi* | [**getScoreSubmissions**](docs/Api/ScoreApi.md#getscoresubmissions) | **GET** /scores/{score}/submissions | List submissions related to the score -*ScoreApi* | [**getScoreTrack**](docs/Api/ScoreApi.md#getscoretrack) | **GET** /scores/{score}/tracks/{track} | Retrieve the details of an audio or video track linked to a score -*ScoreApi* | [**getUserScores**](docs/Api/ScoreApi.md#getuserscores) | **GET** /users/{user}/scores | List user's scores -*ScoreApi* | [**listScoreTracks**](docs/Api/ScoreApi.md#listscoretracks) | **GET** /scores/{score}/tracks | List the audio or video tracks linked to a score -*ScoreApi* | [**markScoreCommentResolved**](docs/Api/ScoreApi.md#markscorecommentresolved) | **PUT** /scores/{score}/comments/{comment}/resolved | Mark the comment as resolved -*ScoreApi* | [**markScoreCommentUnresolved**](docs/Api/ScoreApi.md#markscorecommentunresolved) | **DELETE** /scores/{score}/comments/{comment}/resolved | Mark the comment as unresolved -*ScoreApi* | [**postScoreComment**](docs/Api/ScoreApi.md#postscorecomment) | **POST** /scores/{score}/comments | Post a new comment -*ScoreApi* | [**removeScoreCollaborator**](docs/Api/ScoreApi.md#removescorecollaborator) | **DELETE** /scores/{score}/collaborators/{collaborator} | Delete a collaborator -*ScoreApi* | [**untrashScore**](docs/Api/ScoreApi.md#untrashscore) | **POST** /scores/{score}/untrash | Untrash a score -*ScoreApi* | [**updateScoreComment**](docs/Api/ScoreApi.md#updatescorecomment) | **PUT** /scores/{score}/comments/{comment} | Update an existing comment -*ScoreApi* | [**updateScoreTrack**](docs/Api/ScoreApi.md#updatescoretrack) | **PUT** /scores/{score}/tracks/{track} | Update an audio or video track linked to a score -*UserApi* | [**gerUserLikes**](docs/Api/UserApi.md#geruserlikes) | **GET** /users/{user}/likes | List liked scores -*UserApi* | [**getUser**](docs/Api/UserApi.md#getuser) | **GET** /users/{user} | Get a public user profile -*UserApi* | [**getUserScores**](docs/Api/UserApi.md#getuserscores) | **GET** /users/{user}/scores | List user's scores +## Supported versions +PHP 8.2, 8.3 and 8.4. Versions past their upstream end of life are not supported; see +[MIGRATION.md](MIGRATION.md) if you are on an older runtime. -## Documentation For Models +## Documentation - - [Assignment](docs/Model/Assignment.md) - - [AssignmentCopy](docs/Model/AssignmentCopy.md) - - [AssignmentCreation](docs/Model/AssignmentCreation.md) - - [AssignmentSubmission](docs/Model/AssignmentSubmission.md) - - [AssignmentSubmissionUpdate](docs/Model/AssignmentSubmissionUpdate.md) - - [ClassAttachmentCreation](docs/Model/ClassAttachmentCreation.md) - - [ClassCreation](docs/Model/ClassCreation.md) - - [ClassDetails](docs/Model/ClassDetails.md) - - [ClassDetailsCanvas](docs/Model/ClassDetailsCanvas.md) - - [ClassDetailsClever](docs/Model/ClassDetailsClever.md) - - [ClassDetailsGoogleClassroom](docs/Model/ClassDetailsGoogleClassroom.md) - - [ClassDetailsGoogleDrive](docs/Model/ClassDetailsGoogleDrive.md) - - [ClassDetailsLti](docs/Model/ClassDetailsLti.md) - - [ClassRoles](docs/Model/ClassRoles.md) - - [ClassState](docs/Model/ClassState.md) - - [ClassUpdate](docs/Model/ClassUpdate.md) - - [Collection](docs/Model/Collection.md) - - [CollectionCapabilities](docs/Model/CollectionCapabilities.md) - - [CollectionCreation](docs/Model/CollectionCreation.md) - - [CollectionModification](docs/Model/CollectionModification.md) - - [CollectionPrivacy](docs/Model/CollectionPrivacy.md) - - [CollectionTitle](docs/Model/CollectionTitle.md) - - [CollectionType](docs/Model/CollectionType.md) - - [FlatErrorResponse](docs/Model/FlatErrorResponse.md) - - [FlatLocales](docs/Model/FlatLocales.md) - - [GoogleClassroomCoursework](docs/Model/GoogleClassroomCoursework.md) - - [GoogleClassroomSubmission](docs/Model/GoogleClassroomSubmission.md) - - [Group](docs/Model/Group.md) - - [GroupDetails](docs/Model/GroupDetails.md) - - [GroupType](docs/Model/GroupType.md) - - [LicenseMode](docs/Model/LicenseMode.md) - - [LicenseSources](docs/Model/LicenseSources.md) - - [LmsName](docs/Model/LmsName.md) - - [LtiCredentials](docs/Model/LtiCredentials.md) - - [LtiCredentialsCreation](docs/Model/LtiCredentialsCreation.md) - - [MediaAttachment](docs/Model/MediaAttachment.md) - - [MediaScoreSharingMode](docs/Model/MediaScoreSharingMode.md) - - [OrganizationInvitation](docs/Model/OrganizationInvitation.md) - - [OrganizationInvitationCreation](docs/Model/OrganizationInvitationCreation.md) - - [OrganizationRoles](docs/Model/OrganizationRoles.md) - - [ResourceCollaboratorCreation](docs/Model/ResourceCollaboratorCreation.md) - - [ResourceRights](docs/Model/ResourceRights.md) - - [ResourceSharingKey](docs/Model/ResourceSharingKey.md) - - [ScoreComment](docs/Model/ScoreComment.md) - - [ScoreCommentContext](docs/Model/ScoreCommentContext.md) - - [ScoreCommentCreation](docs/Model/ScoreCommentCreation.md) - - [ScoreCommentUpdate](docs/Model/ScoreCommentUpdate.md) - - [ScoreCommentsCounts](docs/Model/ScoreCommentsCounts.md) - - [ScoreCreation](docs/Model/ScoreCreation.md) - - [ScoreCreationType](docs/Model/ScoreCreationType.md) - - [ScoreData](docs/Model/ScoreData.md) - - [ScoreDataEncoding](docs/Model/ScoreDataEncoding.md) - - [ScoreFork](docs/Model/ScoreFork.md) - - [ScoreLicense](docs/Model/ScoreLicense.md) - - [ScoreLikesCounts](docs/Model/ScoreLikesCounts.md) - - [ScoreModification](docs/Model/ScoreModification.md) - - [ScorePrivacy](docs/Model/ScorePrivacy.md) - - [ScoreRevision](docs/Model/ScoreRevision.md) - - [ScoreRevisionCreation](docs/Model/ScoreRevisionCreation.md) - - [ScoreRevisionStatistics](docs/Model/ScoreRevisionStatistics.md) - - [ScoreSource](docs/Model/ScoreSource.md) - - [ScoreSummary](docs/Model/ScoreSummary.md) - - [ScoreTrack](docs/Model/ScoreTrack.md) - - [ScoreTrackCreation](docs/Model/ScoreTrackCreation.md) - - [ScoreTrackPoint](docs/Model/ScoreTrackPoint.md) - - [ScoreTrackState](docs/Model/ScoreTrackState.md) - - [ScoreTrackType](docs/Model/ScoreTrackType.md) - - [ScoreTrackUpdate](docs/Model/ScoreTrackUpdate.md) - - [ScoreViewsCounts](docs/Model/ScoreViewsCounts.md) - - [UserAdminUpdate](docs/Model/UserAdminUpdate.md) - - [UserBasics](docs/Model/UserBasics.md) - - [UserCreation](docs/Model/UserCreation.md) - - [UserDetailsAdminLicense](docs/Model/UserDetailsAdminLicense.md) - - [UserInstruments](docs/Model/UserInstruments.md) - - [ResourceCollaborator](docs/Model/ResourceCollaborator.md) - - [ScoreDetails](docs/Model/ScoreDetails.md) - - [UserPublicSummary](docs/Model/UserPublicSummary.md) - - [UserDetailsAdmin](docs/Model/UserDetailsAdmin.md) - - [UserPublic](docs/Model/UserPublic.md) - - [UserDetails](docs/Model/UserDetails.md) +- [Quickstart](QUICKSTART.md), install to first call +- [Per-operation reference](docs/reference/), generated +- [API documentation](https://flat.io/developers/docs/api/) +- [Migrating from 0.6.x](MIGRATION.md) +## Verifying this package -## Documentation For Authorization +Packagist publishes from the signed git tag in this repository, so the tag is the provenance: there +is no separate upload step and no publishing credential that could be misused. +```sh +git verify-tag 1.0.0 +composer show flat/api --all +``` -## OAuth2 +## How this client is maintained -- **Type**: OAuth -- **Flow**: accessCode -- **Authorization URL**: https://flat.io/auth/oauth -- **Scopes**: - - **account.public_profile**: Provides access to the basic person's public profile. Education profiles may be anonymized with this scope, you can request the scope `education_profile` to access to the a basic education account profile. - - **account.education_profile**: Provides access to the basic person's education profile and public organization information. - - **scores.readonly**: Allows read-only access to all a user's scores. You won't need this scope to read public scores. - - **scores.social**: Allow to post comments and like scores - - **scores**: Full, permissive scope to access all of a user's scores. - - **collections.readonly**: Allow read-only access to a user's collections. - - **collections.add_scores**: Allow to add scores to a user's collections. - - **collections**: Full, permissive scope to access all of a user's collections. - - **edu.classes**: Full, permissive scope to manage the classes. - - **edu.classes.readonly**: Read-only access to the classes. - - **edu.assignments**: Read-write access to the assignments and submissions. - - **edu.assignments.readonly**: Read-only access to the assignments and submissions. - - **edu.admin**: Full, permissive scope to manage all the admin of an organization. - - **edu.admin.lti**: Access and manage the LTI Credentials for an organization. - - **edu.admin.lti.readonly**: Read-only access to the LTI Credentials of an organization. - - **edu.admin.users**: Access and manage the users and invitations of the organization. - - **edu.admin.users.readonly**: Read-only access to the users and invitations of the organization. +Generated from the public specification published at +[FlatIO/api-reference](https://github.com/FlatIO/api-reference). A new specification release +regenerates, validates and publishes this package automatically, so it never drifts from the API. +Files under `docs/reference/` and the client sources are generated: edit the generator configuration +in `tools/`, not the output. -## Author +## License -developers@flat.io \ No newline at end of file +Apache 2.0. See [LICENSE](LICENSE). diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..3eefcb9 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.0.0 diff --git a/autoload.php b/autoload.php deleted file mode 100644 index d77c31f..0000000 --- a/autoload.php +++ /dev/null @@ -1,54 +0,0 @@ -=5.6", - "ext-curl": "*", - "ext-json": "*", - "ext-mbstring": "*", - "guzzlehttp/guzzle": "^6.2" - }, - "require-dev": { - "phpunit/phpunit": "^5.7", - "squizlabs/php_codesniffer": "~3.4", - "friendsofphp/php-cs-fixer": "~2.15" - }, - "autoload": { - "psr-4": { "Flat\\APIClient\\" : "lib/" } - }, - "autoload-dev": { - "psr-4": { "Flat\\APIClient\\" : "test/" } + "name": "flat/api", + "description": "PHP client for the Flat REST API", + "keywords": [ + "Music", + "Music notation", + "MusicXML", + "MIDI", + "OpenAPI", + "Sheet music", + "Music score" + ], + "homepage": "https://github.com/FlatIO/api-client-php", + "license": "Apache-2.0", + "authors": [ + { + "name": "Flat Team", + "homepage": "https://github.com/FlatIO/api-client-php/graphs/contributors" } + ], + "require": { + "php": "^8.2", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "guzzlehttp/guzzle": "^7.4.5", + "guzzlehttp/psr7": "^2.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.5", + "overtrue/phplint": "^9.0", + "phpunit/phpunit": "^10.0" + }, + "autoload": { + "psr-4": { + "Flat\\APIClient\\": "src/" + }, + "classmap": [ + "src/" + ] + } } diff --git a/docs/Api/AccountApi.md b/docs/Api/AccountApi.md index 990f744..7b2e2bb 100644 --- a/docs/Api/AccountApi.md +++ b/docs/Api/AccountApi.md @@ -51,7 +51,7 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) diff --git a/docs/Api/ClassApi.md b/docs/Api/ClassApi.md index 8f1ac47..b8308dd 100644 --- a/docs/Api/ClassApi.md +++ b/docs/Api/ClassApi.md @@ -46,7 +46,7 @@ $apiInstance = new Flat\APIClient\Api\ClassApi( new GuzzleHttp\Client(), $config ); -$class = "class_example"; // string | Unique identifier of the class +$class = 'class_example'; // string | Unique identifier of the class try { $result = $apiInstance->activateClass($class); @@ -73,7 +73,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -99,8 +99,8 @@ $apiInstance = new Flat\APIClient\Api\ClassApi( new GuzzleHttp\Client(), $config ); -$class = "class_example"; // string | Unique identifier of the class -$user = "user_example"; // string | Unique identifier of the user +$class = 'class_example'; // string | Unique identifier of the class +$user = 'user_example'; // string | Unique identifier of the user try { $apiInstance->addClassUser($class, $user); @@ -127,7 +127,7 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -153,7 +153,7 @@ $apiInstance = new Flat\APIClient\Api\ClassApi( new GuzzleHttp\Client(), $config ); -$class = "class_example"; // string | Unique identifier of the class +$class = 'class_example'; // string | Unique identifier of the class try { $result = $apiInstance->archiveClass($class); @@ -180,13 +180,13 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) # **copyAssignment** -> \Flat\APIClient\Model\Assignment copyAssignment($class, $assignment, $body) +> \Flat\APIClient\Model\Assignment copyAssignment($class, $assignment, $assignmentCopy) Copy an assignment @@ -206,12 +206,12 @@ $apiInstance = new Flat\APIClient\Api\ClassApi( new GuzzleHttp\Client(), $config ); -$class = "class_example"; // string | Unique identifier of the class -$assignment = "assignment_example"; // string | Unique identifier of the assignment -$body = new \Flat\APIClient\Model\AssignmentCopy(); // \Flat\APIClient\Model\AssignmentCopy | +$class = 'class_example'; // string | Unique identifier of the class +$assignment = 'assignment_example'; // string | Unique identifier of the assignment +$assignmentCopy = new \Flat\APIClient\Model\AssignmentCopy(); // \Flat\APIClient\Model\AssignmentCopy | try { - $result = $apiInstance->copyAssignment($class, $assignment, $body); + $result = $apiInstance->copyAssignment($class, $assignment, $assignmentCopy); print_r($result); } catch (Exception $e) { echo 'Exception when calling ClassApi->copyAssignment: ', $e->getMessage(), PHP_EOL; @@ -225,7 +225,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **class** | **string**| Unique identifier of the class | **assignment** | **string**| Unique identifier of the assignment | - **body** | [**\Flat\APIClient\Model\AssignmentCopy**](../Model/AssignmentCopy.md)| | + **assignmentCopy** | [**\Flat\APIClient\Model\AssignmentCopy**](../Model/AssignmentCopy.md)| | ### Return type @@ -243,7 +243,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) # **createAssignment** -> \Flat\APIClient\Model\Assignment createAssignment($class, $body) +> \Flat\APIClient\Model\Assignment createAssignment($class, $assignmentCreation) Assignment creation @@ -263,11 +263,11 @@ $apiInstance = new Flat\APIClient\Api\ClassApi( new GuzzleHttp\Client(), $config ); -$class = "class_example"; // string | Unique identifier of the class -$body = new \Flat\APIClient\Model\AssignmentCreation(); // \Flat\APIClient\Model\AssignmentCreation | +$class = 'class_example'; // string | Unique identifier of the class +$assignmentCreation = new \Flat\APIClient\Model\AssignmentCreation(); // \Flat\APIClient\Model\AssignmentCreation | try { - $result = $apiInstance->createAssignment($class, $body); + $result = $apiInstance->createAssignment($class, $assignmentCreation); print_r($result); } catch (Exception $e) { echo 'Exception when calling ClassApi->createAssignment: ', $e->getMessage(), PHP_EOL; @@ -280,7 +280,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **class** | **string**| Unique identifier of the class | - **body** | [**\Flat\APIClient\Model\AssignmentCreation**](../Model/AssignmentCreation.md)| | [optional] + **assignmentCreation** | [**\Flat\APIClient\Model\AssignmentCreation**](../Model/AssignmentCreation.md)| | [optional] ### Return type @@ -298,7 +298,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) # **createClass** -> \Flat\APIClient\Model\ClassDetails createClass($body) +> \Flat\APIClient\Model\ClassDetails createClass($classCreation) Create a new class @@ -318,10 +318,10 @@ $apiInstance = new Flat\APIClient\Api\ClassApi( new GuzzleHttp\Client(), $config ); -$body = new \Flat\APIClient\Model\ClassCreation(); // \Flat\APIClient\Model\ClassCreation | +$classCreation = new \Flat\APIClient\Model\ClassCreation(); // \Flat\APIClient\Model\ClassCreation | try { - $result = $apiInstance->createClass($body); + $result = $apiInstance->createClass($classCreation); print_r($result); } catch (Exception $e) { echo 'Exception when calling ClassApi->createClass: ', $e->getMessage(), PHP_EOL; @@ -333,7 +333,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**\Flat\APIClient\Model\ClassCreation**](../Model/ClassCreation.md)| | + **classCreation** | [**\Flat\APIClient\Model\ClassCreation**](../Model/ClassCreation.md)| | ### Return type @@ -351,7 +351,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) # **createSubmission** -> \Flat\APIClient\Model\AssignmentSubmission createSubmission($class, $assignment, $body) +> \Flat\APIClient\Model\AssignmentSubmission createSubmission($class, $assignment, $assignmentSubmissionUpdate) Create or edit a submission @@ -371,12 +371,12 @@ $apiInstance = new Flat\APIClient\Api\ClassApi( new GuzzleHttp\Client(), $config ); -$class = "class_example"; // string | Unique identifier of the class -$assignment = "assignment_example"; // string | Unique identifier of the assignment -$body = new \Flat\APIClient\Model\AssignmentSubmissionUpdate(); // \Flat\APIClient\Model\AssignmentSubmissionUpdate | +$class = 'class_example'; // string | Unique identifier of the class +$assignment = 'assignment_example'; // string | Unique identifier of the assignment +$assignmentSubmissionUpdate = new \Flat\APIClient\Model\AssignmentSubmissionUpdate(); // \Flat\APIClient\Model\AssignmentSubmissionUpdate | try { - $result = $apiInstance->createSubmission($class, $assignment, $body); + $result = $apiInstance->createSubmission($class, $assignment, $assignmentSubmissionUpdate); print_r($result); } catch (Exception $e) { echo 'Exception when calling ClassApi->createSubmission: ', $e->getMessage(), PHP_EOL; @@ -390,7 +390,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **class** | **string**| Unique identifier of the class | **assignment** | **string**| Unique identifier of the assignment | - **body** | [**\Flat\APIClient\Model\AssignmentSubmissionUpdate**](../Model/AssignmentSubmissionUpdate.md)| | + **assignmentSubmissionUpdate** | [**\Flat\APIClient\Model\AssignmentSubmissionUpdate**](../Model/AssignmentSubmissionUpdate.md)| | ### Return type @@ -428,8 +428,8 @@ $apiInstance = new Flat\APIClient\Api\ClassApi( new GuzzleHttp\Client(), $config ); -$class = "class_example"; // string | Unique identifier of the class -$user = "user_example"; // string | Unique identifier of the user +$class = 'class_example'; // string | Unique identifier of the class +$user = 'user_example'; // string | Unique identifier of the user try { $apiInstance->deleteClassUser($class, $user); @@ -456,13 +456,13 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) # **editSubmission** -> \Flat\APIClient\Model\AssignmentSubmission editSubmission($class, $assignment, $submission, $body) +> \Flat\APIClient\Model\AssignmentSubmission editSubmission($class, $assignment, $submission, $assignmentSubmissionUpdate) Edit a submission @@ -482,13 +482,13 @@ $apiInstance = new Flat\APIClient\Api\ClassApi( new GuzzleHttp\Client(), $config ); -$class = "class_example"; // string | Unique identifier of the class -$assignment = "assignment_example"; // string | Unique identifier of the assignment -$submission = "submission_example"; // string | Unique identifier of the submission -$body = new \Flat\APIClient\Model\AssignmentSubmissionUpdate(); // \Flat\APIClient\Model\AssignmentSubmissionUpdate | +$class = 'class_example'; // string | Unique identifier of the class +$assignment = 'assignment_example'; // string | Unique identifier of the assignment +$submission = 'submission_example'; // string | Unique identifier of the submission +$assignmentSubmissionUpdate = new \Flat\APIClient\Model\AssignmentSubmissionUpdate(); // \Flat\APIClient\Model\AssignmentSubmissionUpdate | try { - $result = $apiInstance->editSubmission($class, $assignment, $submission, $body); + $result = $apiInstance->editSubmission($class, $assignment, $submission, $assignmentSubmissionUpdate); print_r($result); } catch (Exception $e) { echo 'Exception when calling ClassApi->editSubmission: ', $e->getMessage(), PHP_EOL; @@ -503,7 +503,7 @@ Name | Type | Description | Notes **class** | **string**| Unique identifier of the class | **assignment** | **string**| Unique identifier of the assignment | **submission** | **string**| Unique identifier of the submission | - **body** | [**\Flat\APIClient\Model\AssignmentSubmissionUpdate**](../Model/AssignmentSubmissionUpdate.md)| | + **assignmentSubmissionUpdate** | [**\Flat\APIClient\Model\AssignmentSubmissionUpdate**](../Model/AssignmentSubmissionUpdate.md)| | ### Return type @@ -541,7 +541,7 @@ $apiInstance = new Flat\APIClient\Api\ClassApi( new GuzzleHttp\Client(), $config ); -$enrollmentCode = "enrollmentCode_example"; // string | The enrollment code, available to the teacher in `ClassDetails` +$enrollmentCode = 'enrollmentCode_example'; // string | The enrollment code, available to the teacher in `ClassDetails` try { $result = $apiInstance->enrollClass($enrollmentCode); @@ -568,7 +568,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -592,7 +592,7 @@ $apiInstance = new Flat\APIClient\Api\ClassApi( new GuzzleHttp\Client(), $config ); -$class = "class_example"; // string | Unique identifier of the class +$class = 'class_example'; // string | Unique identifier of the class try { $result = $apiInstance->getClass($class); @@ -619,7 +619,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -645,7 +645,7 @@ $apiInstance = new Flat\APIClient\Api\ClassApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). try { $result = $apiInstance->getScoreSubmissions($score); @@ -672,7 +672,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -696,9 +696,9 @@ $apiInstance = new Flat\APIClient\Api\ClassApi( new GuzzleHttp\Client(), $config ); -$class = "class_example"; // string | Unique identifier of the class -$assignment = "assignment_example"; // string | Unique identifier of the assignment -$submission = "submission_example"; // string | Unique identifier of the submission +$class = 'class_example'; // string | Unique identifier of the class +$assignment = 'assignment_example'; // string | Unique identifier of the assignment +$submission = 'submission_example'; // string | Unique identifier of the submission try { $result = $apiInstance->getSubmission($class, $assignment, $submission); @@ -727,7 +727,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -751,8 +751,8 @@ $apiInstance = new Flat\APIClient\Api\ClassApi( new GuzzleHttp\Client(), $config ); -$class = "class_example"; // string | Unique identifier of the class -$assignment = "assignment_example"; // string | Unique identifier of the assignment +$class = 'class_example'; // string | Unique identifier of the class +$assignment = 'assignment_example'; // string | Unique identifier of the assignment try { $result = $apiInstance->getSubmissions($class, $assignment); @@ -780,7 +780,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -804,7 +804,7 @@ $apiInstance = new Flat\APIClient\Api\ClassApi( new GuzzleHttp\Client(), $config ); -$class = "class_example"; // string | Unique identifier of the class +$class = 'class_example'; // string | Unique identifier of the class try { $result = $apiInstance->listAssignments($class); @@ -831,7 +831,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -857,8 +857,8 @@ $apiInstance = new Flat\APIClient\Api\ClassApi( new GuzzleHttp\Client(), $config ); -$class = "class_example"; // string | Unique identifier of the class -$user = "user_example"; // string | Unique identifier of the user +$class = 'class_example'; // string | Unique identifier of the class +$user = 'user_example'; // string | Unique identifier of the user try { $result = $apiInstance->listClassStudentSubmissions($class, $user); @@ -886,7 +886,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -910,7 +910,7 @@ $apiInstance = new Flat\APIClient\Api\ClassApi( new GuzzleHttp\Client(), $config ); -$state = "active"; // string | Filter the classes by state +$state = 'active'; // string | Filter the classes by state try { $result = $apiInstance->listClasses($state); @@ -925,7 +925,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **state** | **string**| Filter the classes by state | [optional] [default to active] + **state** | **string**| Filter the classes by state | [optional] [default to 'active'] ### Return type @@ -937,7 +937,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -963,7 +963,7 @@ $apiInstance = new Flat\APIClient\Api\ClassApi( new GuzzleHttp\Client(), $config ); -$class = "class_example"; // string | Unique identifier of the class +$class = 'class_example'; // string | Unique identifier of the class try { $result = $apiInstance->unarchiveClass($class); @@ -990,13 +990,13 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) # **updateClass** -> \Flat\APIClient\Model\ClassDetails updateClass($class, $body) +> \Flat\APIClient\Model\ClassDetails updateClass($class, $classUpdate) Update the class @@ -1016,11 +1016,11 @@ $apiInstance = new Flat\APIClient\Api\ClassApi( new GuzzleHttp\Client(), $config ); -$class = "class_example"; // string | Unique identifier of the class -$body = new \Flat\APIClient\Model\ClassUpdate(); // \Flat\APIClient\Model\ClassUpdate | Details of the Class +$class = 'class_example'; // string | Unique identifier of the class +$classUpdate = new \Flat\APIClient\Model\ClassUpdate(); // \Flat\APIClient\Model\ClassUpdate | Details of the Class try { - $result = $apiInstance->updateClass($class, $body); + $result = $apiInstance->updateClass($class, $classUpdate); print_r($result); } catch (Exception $e) { echo 'Exception when calling ClassApi->updateClass: ', $e->getMessage(), PHP_EOL; @@ -1033,7 +1033,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **class** | **string**| Unique identifier of the class | - **body** | [**\Flat\APIClient\Model\ClassUpdate**](../Model/ClassUpdate.md)| Details of the Class | [optional] + **classUpdate** | [**\Flat\APIClient\Model\ClassUpdate**](../Model/ClassUpdate.md)| Details of the Class | [optional] ### Return type diff --git a/docs/Api/CollectionApi.md b/docs/Api/CollectionApi.md index beb74ea..9d0a9f8 100644 --- a/docs/Api/CollectionApi.md +++ b/docs/Api/CollectionApi.md @@ -36,9 +36,9 @@ $apiInstance = new Flat\APIClient\Api\CollectionApi( new GuzzleHttp\Client(), $config ); -$collection = "collection_example"; // string | Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). -$sharingKey = "sharingKey_example"; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. +$collection = 'collection_example'; // string | Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$sharingKey = 'sharingKey_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. try { $result = $apiInstance->addScoreToCollection($collection, $score, $sharingKey); @@ -67,13 +67,13 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) # **createCollection** -> \Flat\APIClient\Model\Collection createCollection($body) +> \Flat\APIClient\Model\Collection createCollection($collectionCreation) Create a new collection @@ -93,10 +93,10 @@ $apiInstance = new Flat\APIClient\Api\CollectionApi( new GuzzleHttp\Client(), $config ); -$body = new \Flat\APIClient\Model\CollectionCreation(); // \Flat\APIClient\Model\CollectionCreation | +$collectionCreation = new \Flat\APIClient\Model\CollectionCreation(); // \Flat\APIClient\Model\CollectionCreation | try { - $result = $apiInstance->createCollection($body); + $result = $apiInstance->createCollection($collectionCreation); print_r($result); } catch (Exception $e) { echo 'Exception when calling CollectionApi->createCollection: ', $e->getMessage(), PHP_EOL; @@ -108,7 +108,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**\Flat\APIClient\Model\CollectionCreation**](../Model/CollectionCreation.md)| | + **collectionCreation** | [**\Flat\APIClient\Model\CollectionCreation**](../Model/CollectionCreation.md)| | ### Return type @@ -146,7 +146,7 @@ $apiInstance = new Flat\APIClient\Api\CollectionApi( new GuzzleHttp\Client(), $config ); -$collection = "collection_example"; // string | Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted +$collection = 'collection_example'; // string | Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted try { $apiInstance->deleteCollection($collection); @@ -172,7 +172,7 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -198,8 +198,8 @@ $apiInstance = new Flat\APIClient\Api\CollectionApi( new GuzzleHttp\Client(), $config ); -$collection = "collection_example"; // string | Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$collection = 'collection_example'; // string | Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). try { $apiInstance->deleteScoreFromCollection($collection, $score); @@ -226,13 +226,13 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) # **editCollection** -> \Flat\APIClient\Model\Collection editCollection($collection, $body) +> \Flat\APIClient\Model\Collection editCollection($collection, $collectionModification) Update a collection's metadata @@ -250,11 +250,11 @@ $apiInstance = new Flat\APIClient\Api\CollectionApi( new GuzzleHttp\Client(), $config ); -$collection = "collection_example"; // string | Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted -$body = new \Flat\APIClient\Model\CollectionModification(); // \Flat\APIClient\Model\CollectionModification | +$collection = 'collection_example'; // string | Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted +$collectionModification = new \Flat\APIClient\Model\CollectionModification(); // \Flat\APIClient\Model\CollectionModification | try { - $result = $apiInstance->editCollection($collection, $body); + $result = $apiInstance->editCollection($collection, $collectionModification); print_r($result); } catch (Exception $e) { echo 'Exception when calling CollectionApi->editCollection: ', $e->getMessage(), PHP_EOL; @@ -267,7 +267,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **collection** | **string**| Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted | - **body** | [**\Flat\APIClient\Model\CollectionModification**](../Model/CollectionModification.md)| | [optional] + **collectionModification** | [**\Flat\APIClient\Model\CollectionModification**](../Model/CollectionModification.md)| | [optional] ### Return type @@ -303,8 +303,8 @@ $apiInstance = new Flat\APIClient\Api\CollectionApi( new GuzzleHttp\Client(), $config ); -$collection = "collection_example"; // string | Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted -$sharingKey = "sharingKey_example"; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. +$collection = 'collection_example'; // string | Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted +$sharingKey = 'sharingKey_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. try { $result = $apiInstance->getCollection($collection, $sharingKey); @@ -332,7 +332,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -358,13 +358,13 @@ $apiInstance = new Flat\APIClient\Api\CollectionApi( new GuzzleHttp\Client(), $config ); -$collection = "collection_example"; // string | Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted -$sharingKey = "sharingKey_example"; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. -$sort = "sort_example"; // string | Sort -$direction = "direction_example"; // string | Sort direction +$collection = 'collection_example'; // string | Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted +$sharingKey = 'sharingKey_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. +$sort = 'sort_example'; // string | Sort +$direction = 'direction_example'; // string | Sort direction $limit = 25; // int | This is the maximum number of objects that may be returned -$next = "next_example"; // string | An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. -$previous = "previous_example"; // string | An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$next = 'next_example'; // string | An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$previous = 'previous_example'; // string | An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. try { $result = $apiInstance->listCollectionScores($collection, $sharingKey, $sort, $direction, $limit, $next, $previous); @@ -397,7 +397,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -423,12 +423,12 @@ $apiInstance = new Flat\APIClient\Api\CollectionApi( new GuzzleHttp\Client(), $config ); -$parent = "root"; // string | List the collection contained in this `parent` collection. This option doesn't provide a complete multi-level collection support. When sharing a collection with someone, this one will have as `parent` `sharedWithMe`. -$sort = "sort_example"; // string | Sort -$direction = "direction_example"; // string | Sort direction +$parent = 'root'; // string | List the collection contained in this `parent` collection. This option doesn't provide a complete multi-level collection support. When sharing a collection with someone, this one will have as `parent` `sharedWithMe`. +$sort = 'sort_example'; // string | Sort +$direction = 'direction_example'; // string | Sort direction $limit = 25; // int | This is the maximum number of objects that may be returned -$next = "next_example"; // string | An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. -$previous = "previous_example"; // string | An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$next = 'next_example'; // string | An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$previous = 'previous_example'; // string | An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. try { $result = $apiInstance->listCollections($parent, $sort, $direction, $limit, $next, $previous); @@ -443,7 +443,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **parent** | **string**| List the collection contained in this `parent` collection. This option doesn't provide a complete multi-level collection support. When sharing a collection with someone, this one will have as `parent` `sharedWithMe`. | [optional] [default to root] + **parent** | **string**| List the collection contained in this `parent` collection. This option doesn't provide a complete multi-level collection support. When sharing a collection with someone, this one will have as `parent` `sharedWithMe`. | [optional] [default to 'root'] **sort** | **string**| Sort | [optional] **direction** | **string**| Sort direction | [optional] **limit** | **int**| This is the maximum number of objects that may be returned | [optional] [default to 25] @@ -460,7 +460,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -486,7 +486,7 @@ $apiInstance = new Flat\APIClient\Api\CollectionApi( new GuzzleHttp\Client(), $config ); -$collection = "collection_example"; // string | Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted +$collection = 'collection_example'; // string | Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted try { $apiInstance->untrashCollection($collection); @@ -512,7 +512,7 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) diff --git a/docs/Api/GroupApi.md b/docs/Api/GroupApi.md index 990c461..0d5367a 100644 --- a/docs/Api/GroupApi.md +++ b/docs/Api/GroupApi.md @@ -28,7 +28,7 @@ $apiInstance = new Flat\APIClient\Api\GroupApi( new GuzzleHttp\Client(), $config ); -$group = "group_example"; // string | Unique identifier of a Flat group +$group = 'group_example'; // string | Unique identifier of a Flat group try { $result = $apiInstance->getGroupDetails($group); @@ -55,7 +55,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -81,8 +81,8 @@ $apiInstance = new Flat\APIClient\Api\GroupApi( new GuzzleHttp\Client(), $config ); -$group = "group_example"; // string | Unique identifier of a Flat group -$parent = "parent_example"; // string | Filter the score forked from the score id `parent` +$group = 'group_example'; // string | Unique identifier of a Flat group +$parent = 'parent_example'; // string | Filter the score forked from the score id `parent` try { $result = $apiInstance->getGroupScores($group, $parent); @@ -110,7 +110,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -134,7 +134,7 @@ $apiInstance = new Flat\APIClient\Api\GroupApi( new GuzzleHttp\Client(), $config ); -$group = "group_example"; // string | Unique identifier of a Flat group +$group = 'group_example'; // string | Unique identifier of a Flat group try { $result = $apiInstance->listGroupUsers($group); @@ -161,7 +161,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) diff --git a/docs/Api/OrganizationApi.md b/docs/Api/OrganizationApi.md index 699fae1..52dfba9 100644 --- a/docs/Api/OrganizationApi.md +++ b/docs/Api/OrganizationApi.md @@ -17,7 +17,7 @@ Method | HTTP request | Description # **createLtiCredentials** -> \Flat\APIClient\Model\LtiCredentials createLtiCredentials($body) +> \Flat\APIClient\Model\LtiCredentials createLtiCredentials($ltiCredentialsCreation) Create a new couple of LTI 1.x credentials @@ -37,10 +37,10 @@ $apiInstance = new Flat\APIClient\Api\OrganizationApi( new GuzzleHttp\Client(), $config ); -$body = new \Flat\APIClient\Model\LtiCredentialsCreation(); // \Flat\APIClient\Model\LtiCredentialsCreation | +$ltiCredentialsCreation = new \Flat\APIClient\Model\LtiCredentialsCreation(); // \Flat\APIClient\Model\LtiCredentialsCreation | try { - $result = $apiInstance->createLtiCredentials($body); + $result = $apiInstance->createLtiCredentials($ltiCredentialsCreation); print_r($result); } catch (Exception $e) { echo 'Exception when calling OrganizationApi->createLtiCredentials: ', $e->getMessage(), PHP_EOL; @@ -52,7 +52,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**\Flat\APIClient\Model\LtiCredentialsCreation**](../Model/LtiCredentialsCreation.md)| | + **ltiCredentialsCreation** | [**\Flat\APIClient\Model\LtiCredentialsCreation**](../Model/LtiCredentialsCreation.md)| | ### Return type @@ -70,7 +70,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) # **createOrganizationInvitation** -> \Flat\APIClient\Model\OrganizationInvitation createOrganizationInvitation($body) +> \Flat\APIClient\Model\OrganizationInvitation createOrganizationInvitation($organizationInvitationCreation) Create a new invitation to join the organization @@ -90,10 +90,10 @@ $apiInstance = new Flat\APIClient\Api\OrganizationApi( new GuzzleHttp\Client(), $config ); -$body = new \Flat\APIClient\Model\OrganizationInvitationCreation(); // \Flat\APIClient\Model\OrganizationInvitationCreation | +$organizationInvitationCreation = new \Flat\APIClient\Model\OrganizationInvitationCreation(); // \Flat\APIClient\Model\OrganizationInvitationCreation | try { - $result = $apiInstance->createOrganizationInvitation($body); + $result = $apiInstance->createOrganizationInvitation($organizationInvitationCreation); print_r($result); } catch (Exception $e) { echo 'Exception when calling OrganizationApi->createOrganizationInvitation: ', $e->getMessage(), PHP_EOL; @@ -105,7 +105,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**\Flat\APIClient\Model\OrganizationInvitationCreation**](../Model/OrganizationInvitationCreation.md)| | [optional] + **organizationInvitationCreation** | [**\Flat\APIClient\Model\OrganizationInvitationCreation**](../Model/OrganizationInvitationCreation.md)| | [optional] ### Return type @@ -123,7 +123,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) # **createOrganizationUser** -> \Flat\APIClient\Model\UserDetailsAdmin createOrganizationUser($body) +> \Flat\APIClient\Model\UserDetailsAdmin createOrganizationUser($userCreation) Create a new user account @@ -141,10 +141,10 @@ $apiInstance = new Flat\APIClient\Api\OrganizationApi( new GuzzleHttp\Client(), $config ); -$body = new \Flat\APIClient\Model\UserCreation(); // \Flat\APIClient\Model\UserCreation | +$userCreation = new \Flat\APIClient\Model\UserCreation(); // \Flat\APIClient\Model\UserCreation | try { - $result = $apiInstance->createOrganizationUser($body); + $result = $apiInstance->createOrganizationUser($userCreation); print_r($result); } catch (Exception $e) { echo 'Exception when calling OrganizationApi->createOrganizationUser: ', $e->getMessage(), PHP_EOL; @@ -156,7 +156,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**\Flat\APIClient\Model\UserCreation**](../Model/UserCreation.md)| | [optional] + **userCreation** | [**\Flat\APIClient\Model\UserCreation**](../Model/UserCreation.md)| | [optional] ### Return type @@ -215,7 +215,7 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -239,10 +239,10 @@ $apiInstance = new Flat\APIClient\Api\OrganizationApi( new GuzzleHttp\Client(), $config ); -$role = "role_example"; // string | Filter users by role +$role = 'role_example'; // string | Filter users by role $limit = 50; // int | This is the maximum number of objects that may be returned -$next = "next_example"; // string | An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. -$previous = "previous_example"; // string | An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$next = 'next_example'; // string | An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$previous = 'previous_example'; // string | An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. try { $result = $apiInstance->listOrganizationInvitations($role, $limit, $next, $previous); @@ -272,7 +272,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -296,10 +296,10 @@ $apiInstance = new Flat\APIClient\Api\OrganizationApi( new GuzzleHttp\Client(), $config ); -$role = "role_example"; // string | Filter users by role +$role = 'role_example'; // string | Filter users by role $limit = 50; // int | This is the maximum number of objects that may be returned -$next = "next_example"; // string | An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. -$previous = "previous_example"; // string | An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$next = 'next_example'; // string | An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$previous = 'previous_example'; // string | An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. try { $result = $apiInstance->listOrganizationUsers($role, $limit, $next, $previous); @@ -329,7 +329,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -353,7 +353,7 @@ $apiInstance = new Flat\APIClient\Api\OrganizationApi( new GuzzleHttp\Client(), $config ); -$invitation = "invitation_example"; // string | Unique identifier of the invitation +$invitation = 'invitation_example'; // string | Unique identifier of the invitation try { $apiInstance->removeOrganizationInvitation($invitation); @@ -379,7 +379,7 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -405,8 +405,8 @@ $apiInstance = new Flat\APIClient\Api\OrganizationApi( new GuzzleHttp\Client(), $config ); -$user = "user_example"; // string | Unique identifier of the Flat account -$convertToIndividual = true; // bool | If `true`, the account will be only removed from the organization and converted into an individual account on our public website, https://flat.io. This operation will remove the education-related data from the account. Before realizing this operation, you need to be sure that the user is at least 13 years old and that this one has read and agreed to the Individual Terms of Services of Flat available on https://flat.io/legal. +$user = 'user_example'; // string | Unique identifier of the Flat account +$convertToIndividual = True; // bool | If `true`, the account will be only removed from the organization and converted into an individual account on our public website, https://flat.io. This operation will remove the education-related data from the account. Before realizing this operation, you need to be sure that the user is at least 13 years old and that this one has read and agreed to the Individual Terms of Services of Flat available on https://flat.io/legal. try { $apiInstance->removeOrganizationUser($user, $convertToIndividual); @@ -433,7 +433,7 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -457,7 +457,7 @@ $apiInstance = new Flat\APIClient\Api\OrganizationApi( new GuzzleHttp\Client(), $config ); -$credentials = "credentials_example"; // string | Credentials unique identifier +$credentials = 'credentials_example'; // string | Credentials unique identifier try { $apiInstance->revokeLtiCredentials($credentials); @@ -483,13 +483,13 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) # **updateOrganizationUser** -> \Flat\APIClient\Model\UserDetailsAdmin updateOrganizationUser($user, $body) +> \Flat\APIClient\Model\UserDetailsAdmin updateOrganizationUser($user, $userAdminUpdate) Update account information @@ -507,11 +507,11 @@ $apiInstance = new Flat\APIClient\Api\OrganizationApi( new GuzzleHttp\Client(), $config ); -$user = "user_example"; // string | Unique identifier of the Flat account -$body = new \Flat\APIClient\Model\UserAdminUpdate(); // \Flat\APIClient\Model\UserAdminUpdate | +$user = 'user_example'; // string | Unique identifier of the Flat account +$userAdminUpdate = new \Flat\APIClient\Model\UserAdminUpdate(); // \Flat\APIClient\Model\UserAdminUpdate | try { - $result = $apiInstance->updateOrganizationUser($user, $body); + $result = $apiInstance->updateOrganizationUser($user, $userAdminUpdate); print_r($result); } catch (Exception $e) { echo 'Exception when calling OrganizationApi->updateOrganizationUser: ', $e->getMessage(), PHP_EOL; @@ -524,7 +524,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **user** | **string**| Unique identifier of the Flat account | - **body** | [**\Flat\APIClient\Model\UserAdminUpdate**](../Model/UserAdminUpdate.md)| | + **userAdminUpdate** | [**\Flat\APIClient\Model\UserAdminUpdate**](../Model/UserAdminUpdate.md)| | ### Return type diff --git a/docs/Api/ScoreApi.md b/docs/Api/ScoreApi.md index 8ba6330..fd38ff2 100644 --- a/docs/Api/ScoreApi.md +++ b/docs/Api/ScoreApi.md @@ -36,7 +36,7 @@ Method | HTTP request | Description # **addScoreCollaborator** -> \Flat\APIClient\Model\ResourceCollaborator addScoreCollaborator($score, $body) +> \Flat\APIClient\Model\ResourceCollaborator addScoreCollaborator($score, $resourceCollaboratorCreation) Add a new collaborator @@ -56,11 +56,11 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). -$body = new \Flat\APIClient\Model\ResourceCollaboratorCreation(); // \Flat\APIClient\Model\ResourceCollaboratorCreation | +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$resourceCollaboratorCreation = new \Flat\APIClient\Model\ResourceCollaboratorCreation(); // \Flat\APIClient\Model\ResourceCollaboratorCreation | try { - $result = $apiInstance->addScoreCollaborator($score, $body); + $result = $apiInstance->addScoreCollaborator($score, $resourceCollaboratorCreation); print_r($result); } catch (Exception $e) { echo 'Exception when calling ScoreApi->addScoreCollaborator: ', $e->getMessage(), PHP_EOL; @@ -73,7 +73,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | - **body** | [**\Flat\APIClient\Model\ResourceCollaboratorCreation**](../Model/ResourceCollaboratorCreation.md)| | + **resourceCollaboratorCreation** | [**\Flat\APIClient\Model\ResourceCollaboratorCreation**](../Model/ResourceCollaboratorCreation.md)| | ### Return type @@ -91,7 +91,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) # **addScoreTrack** -> \Flat\APIClient\Model\ScoreTrack addScoreTrack($score, $body) +> \Flat\APIClient\Model\ScoreTrack addScoreTrack($score, $scoreTrackCreation) Add a new video or audio track to the score @@ -111,11 +111,11 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). -$body = new \Flat\APIClient\Model\ScoreTrackCreation(); // \Flat\APIClient\Model\ScoreTrackCreation | +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$scoreTrackCreation = new \Flat\APIClient\Model\ScoreTrackCreation(); // \Flat\APIClient\Model\ScoreTrackCreation | try { - $result = $apiInstance->addScoreTrack($score, $body); + $result = $apiInstance->addScoreTrack($score, $scoreTrackCreation); print_r($result); } catch (Exception $e) { echo 'Exception when calling ScoreApi->addScoreTrack: ', $e->getMessage(), PHP_EOL; @@ -128,7 +128,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | - **body** | [**\Flat\APIClient\Model\ScoreTrackCreation**](../Model/ScoreTrackCreation.md)| | + **scoreTrackCreation** | [**\Flat\APIClient\Model\ScoreTrackCreation**](../Model/ScoreTrackCreation.md)| | ### Return type @@ -146,7 +146,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) # **createScore** -> \Flat\APIClient\Model\ScoreDetails createScore($body) +> \Flat\APIClient\Model\ScoreDetails createScore($scoreCreation) Create a new score @@ -166,10 +166,10 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$body = new \Flat\APIClient\Model\ScoreCreation(); // \Flat\APIClient\Model\ScoreCreation | +$scoreCreation = new \Flat\APIClient\Model\ScoreCreation(); // \Flat\APIClient\Model\ScoreCreation | try { - $result = $apiInstance->createScore($body); + $result = $apiInstance->createScore($scoreCreation); print_r($result); } catch (Exception $e) { echo 'Exception when calling ScoreApi->createScore: ', $e->getMessage(), PHP_EOL; @@ -181,7 +181,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**\Flat\APIClient\Model\ScoreCreation**](../Model/ScoreCreation.md)| | + **scoreCreation** | [**\Flat\APIClient\Model\ScoreCreation**](../Model/ScoreCreation.md)| | ### Return type @@ -199,7 +199,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) # **createScoreRevision** -> \Flat\APIClient\Model\ScoreRevision createScoreRevision($score, $body) +> \Flat\APIClient\Model\ScoreRevision createScoreRevision($score, $scoreRevisionCreation) Create a new revision @@ -219,11 +219,11 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). -$body = new \Flat\APIClient\Model\ScoreRevisionCreation(); // \Flat\APIClient\Model\ScoreRevisionCreation | +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$scoreRevisionCreation = new \Flat\APIClient\Model\ScoreRevisionCreation(); // \Flat\APIClient\Model\ScoreRevisionCreation | try { - $result = $apiInstance->createScoreRevision($score, $body); + $result = $apiInstance->createScoreRevision($score, $scoreRevisionCreation); print_r($result); } catch (Exception $e) { echo 'Exception when calling ScoreApi->createScoreRevision: ', $e->getMessage(), PHP_EOL; @@ -236,7 +236,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | - **body** | [**\Flat\APIClient\Model\ScoreRevisionCreation**](../Model/ScoreRevisionCreation.md)| | + **scoreRevisionCreation** | [**\Flat\APIClient\Model\ScoreRevisionCreation**](../Model/ScoreRevisionCreation.md)| | ### Return type @@ -274,7 +274,7 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). try { $apiInstance->deleteScore($score); @@ -300,7 +300,7 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -324,9 +324,9 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). -$comment = "comment_example"; // string | Unique identifier of a sheet music comment -$sharingKey = "sharingKey_example"; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$comment = 'comment_example'; // string | Unique identifier of a sheet music comment +$sharingKey = 'sharingKey_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. try { $apiInstance->deleteScoreComment($score, $comment, $sharingKey); @@ -354,7 +354,7 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -378,8 +378,8 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). -$track = "track_example"; // string | Unique identifier of a score audio track +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$track = 'track_example'; // string | Unique identifier of a score audio track try { $apiInstance->deleteScoreTrack($score, $track); @@ -406,13 +406,13 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) # **editScore** -> \Flat\APIClient\Model\ScoreDetails editScore($score, $body) +> \Flat\APIClient\Model\ScoreDetails editScore($score, $scoreModification) Edit a score's metadata @@ -432,11 +432,11 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). -$body = new \Flat\APIClient\Model\ScoreModification(); // \Flat\APIClient\Model\ScoreModification | +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$scoreModification = new \Flat\APIClient\Model\ScoreModification(); // \Flat\APIClient\Model\ScoreModification | try { - $result = $apiInstance->editScore($score, $body); + $result = $apiInstance->editScore($score, $scoreModification); print_r($result); } catch (Exception $e) { echo 'Exception when calling ScoreApi->editScore: ', $e->getMessage(), PHP_EOL; @@ -449,7 +449,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | - **body** | [**\Flat\APIClient\Model\ScoreModification**](../Model/ScoreModification.md)| | [optional] + **scoreModification** | [**\Flat\APIClient\Model\ScoreModification**](../Model/ScoreModification.md)| | [optional] ### Return type @@ -467,7 +467,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) # **forkScore** -> \Flat\APIClient\Model\ScoreDetails forkScore($score, $body, $sharingKey) +> \Flat\APIClient\Model\ScoreDetails forkScore($score, $scoreFork, $sharingKey) Fork a score @@ -487,12 +487,12 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). -$body = new \Flat\APIClient\Model\ScoreFork(); // \Flat\APIClient\Model\ScoreFork | -$sharingKey = "sharingKey_example"; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$scoreFork = new \Flat\APIClient\Model\ScoreFork(); // \Flat\APIClient\Model\ScoreFork | +$sharingKey = 'sharingKey_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. try { - $result = $apiInstance->forkScore($score, $body, $sharingKey); + $result = $apiInstance->forkScore($score, $scoreFork, $sharingKey); print_r($result); } catch (Exception $e) { echo 'Exception when calling ScoreApi->forkScore: ', $e->getMessage(), PHP_EOL; @@ -505,7 +505,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | - **body** | [**\Flat\APIClient\Model\ScoreFork**](../Model/ScoreFork.md)| | + **scoreFork** | [**\Flat\APIClient\Model\ScoreFork**](../Model/ScoreFork.md)| | **sharingKey** | **string**| This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. | [optional] ### Return type @@ -542,8 +542,8 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$user = "user_example"; // string | Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. -$ids = true; // bool | Return only the identifiers of the scores +$user = 'user_example'; // string | Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. +$ids = True; // bool | Return only the identifiers of the scores try { $result = $apiInstance->gerUserLikes($user, $ids); @@ -571,7 +571,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -597,8 +597,8 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$group = "group_example"; // string | Unique identifier of a Flat group -$parent = "parent_example"; // string | Filter the score forked from the score id `parent` +$group = 'group_example'; // string | Unique identifier of a Flat group +$parent = 'parent_example'; // string | Filter the score forked from the score id `parent` try { $result = $apiInstance->getGroupScores($group, $parent); @@ -626,7 +626,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -652,8 +652,8 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). -$sharingKey = "sharingKey_example"; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$sharingKey = 'sharingKey_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. try { $result = $apiInstance->getScore($score, $sharingKey); @@ -681,7 +681,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -707,9 +707,9 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). -$collaborator = "collaborator_example"; // string | Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** -$sharingKey = "sharingKey_example"; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$collaborator = 'collaborator_example'; // string | Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** +$sharingKey = 'sharingKey_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. try { $result = $apiInstance->getScoreCollaborator($score, $collaborator, $sharingKey); @@ -738,7 +738,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -764,8 +764,8 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). -$sharingKey = "sharingKey_example"; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$sharingKey = 'sharingKey_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. try { $result = $apiInstance->getScoreCollaborators($score, $sharingKey); @@ -793,7 +793,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -819,11 +819,11 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). -$sharingKey = "sharingKey_example"; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. -$type = "type_example"; // string | Filter the comments by type -$sort = "sort_example"; // string | Sort -$direction = "direction_example"; // string | Sort direction +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$sharingKey = 'sharingKey_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. +$type = 'type_example'; // string | Filter the comments by type +$sort = 'sort_example'; // string | Sort +$direction = 'direction_example'; // string | Sort direction try { $result = $apiInstance->getScoreComments($score, $sharingKey, $type, $sort, $direction); @@ -854,7 +854,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -880,9 +880,9 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). -$revision = "revision_example"; // string | Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. -$sharingKey = "sharingKey_example"; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$revision = 'revision_example'; // string | Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. +$sharingKey = 'sharingKey_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. try { $result = $apiInstance->getScoreRevision($score, $revision, $sharingKey); @@ -911,13 +911,13 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) # **getScoreRevisionData** -> string getScoreRevisionData($score, $revision, $format, $sharingKey, $parts, $onlyCached) +> \SplFileObject getScoreRevisionData($score, $revision, $format, $sharingKey, $parts, $onlyCached) Get a score revision data @@ -937,12 +937,12 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). -$revision = "revision_example"; // string | Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. -$format = "format_example"; // string | The format of the file you will retrieve -$sharingKey = "sharingKey_example"; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. -$parts = "parts_example"; // string | An optional a set of parts to be exported. This parameter must be specified with a list of integers. For example \"1,2,5\". -$onlyCached = true; // bool | Only return files already generated and cached in Flat's production cache. If the file is not availabe, a 404 will be returned +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$revision = 'revision_example'; // string | Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. +$format = 'format_example'; // string | The format of the file you will retrieve +$sharingKey = 'sharingKey_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. +$parts = 'parts_example'; // string | An optional a set of parts to be exported. This parameter must be specified with a list of integers. For example \"1,2,5\". +$onlyCached = True; // bool | Only return files already generated and cached in Flat's production cache. If the file is not availabe, a 404 will be returned try { $result = $apiInstance->getScoreRevisionData($score, $revision, $format, $sharingKey, $parts, $onlyCached); @@ -966,7 +966,7 @@ Name | Type | Description | Notes ### Return type -**string** +[**\SplFileObject**](../Model/\SplFileObject.md) ### Authorization @@ -974,7 +974,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json, application/vnd.recordare.musicxml+xml, application/vnd.recordare.musicxml, audio/mp3, audio/wav, audio/midi, image/png [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -1000,8 +1000,8 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). -$sharingKey = "sharingKey_example"; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$sharingKey = 'sharingKey_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. try { $result = $apiInstance->getScoreRevisions($score, $sharingKey); @@ -1029,7 +1029,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -1055,7 +1055,7 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). try { $result = $apiInstance->getScoreSubmissions($score); @@ -1082,7 +1082,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -1106,9 +1106,9 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). -$track = "track_example"; // string | Unique identifier of a score audio track -$sharingKey = "sharingKey_example"; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$track = 'track_example'; // string | Unique identifier of a score audio track +$sharingKey = 'sharingKey_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. try { $result = $apiInstance->getScoreTrack($score, $track, $sharingKey); @@ -1137,7 +1137,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -1163,8 +1163,8 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$user = "user_example"; // string | Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. -$parent = "parent_example"; // string | Filter the score forked from the score id `parent` +$user = 'user_example'; // string | Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. +$parent = 'parent_example'; // string | Filter the score forked from the score id `parent` try { $result = $apiInstance->getUserScores($user, $parent); @@ -1192,7 +1192,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -1216,8 +1216,8 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). -$sharingKey = "sharingKey_example"; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$sharingKey = 'sharingKey_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. try { $result = $apiInstance->listScoreTracks($score, $sharingKey); @@ -1245,7 +1245,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -1269,9 +1269,9 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). -$comment = "comment_example"; // string | Unique identifier of a sheet music comment -$sharingKey = "sharingKey_example"; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$comment = 'comment_example'; // string | Unique identifier of a sheet music comment +$sharingKey = 'sharingKey_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. try { $apiInstance->markScoreCommentResolved($score, $comment, $sharingKey); @@ -1299,7 +1299,7 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -1323,9 +1323,9 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). -$comment = "comment_example"; // string | Unique identifier of a sheet music comment -$sharingKey = "sharingKey_example"; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$comment = 'comment_example'; // string | Unique identifier of a sheet music comment +$sharingKey = 'sharingKey_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. try { $apiInstance->markScoreCommentUnresolved($score, $comment, $sharingKey); @@ -1353,13 +1353,13 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) # **postScoreComment** -> \Flat\APIClient\Model\ScoreComment postScoreComment($score, $body, $sharingKey) +> \Flat\APIClient\Model\ScoreComment postScoreComment($score, $scoreCommentCreation, $sharingKey) Post a new comment @@ -1379,12 +1379,12 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). -$body = new \Flat\APIClient\Model\ScoreCommentCreation(); // \Flat\APIClient\Model\ScoreCommentCreation | -$sharingKey = "sharingKey_example"; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$scoreCommentCreation = new \Flat\APIClient\Model\ScoreCommentCreation(); // \Flat\APIClient\Model\ScoreCommentCreation | +$sharingKey = 'sharingKey_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. try { - $result = $apiInstance->postScoreComment($score, $body, $sharingKey); + $result = $apiInstance->postScoreComment($score, $scoreCommentCreation, $sharingKey); print_r($result); } catch (Exception $e) { echo 'Exception when calling ScoreApi->postScoreComment: ', $e->getMessage(), PHP_EOL; @@ -1397,7 +1397,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | - **body** | [**\Flat\APIClient\Model\ScoreCommentCreation**](../Model/ScoreCommentCreation.md)| | + **scoreCommentCreation** | [**\Flat\APIClient\Model\ScoreCommentCreation**](../Model/ScoreCommentCreation.md)| | **sharingKey** | **string**| This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. | [optional] ### Return type @@ -1436,8 +1436,8 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). -$collaborator = "collaborator_example"; // string | Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$collaborator = 'collaborator_example'; // string | Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** try { $apiInstance->removeScoreCollaborator($score, $collaborator); @@ -1464,7 +1464,7 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -1486,7 +1486,7 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). try { $apiInstance->untrashScore($score); @@ -1512,13 +1512,13 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) # **updateScoreComment** -> \Flat\APIClient\Model\ScoreComment updateScoreComment($score, $comment, $body, $sharingKey) +> \Flat\APIClient\Model\ScoreComment updateScoreComment($score, $comment, $scoreCommentUpdate, $sharingKey) Update an existing comment @@ -1536,13 +1536,13 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). -$comment = "comment_example"; // string | Unique identifier of a sheet music comment -$body = new \Flat\APIClient\Model\ScoreCommentUpdate(); // \Flat\APIClient\Model\ScoreCommentUpdate | -$sharingKey = "sharingKey_example"; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$comment = 'comment_example'; // string | Unique identifier of a sheet music comment +$scoreCommentUpdate = new \Flat\APIClient\Model\ScoreCommentUpdate(); // \Flat\APIClient\Model\ScoreCommentUpdate | +$sharingKey = 'sharingKey_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. try { - $result = $apiInstance->updateScoreComment($score, $comment, $body, $sharingKey); + $result = $apiInstance->updateScoreComment($score, $comment, $scoreCommentUpdate, $sharingKey); print_r($result); } catch (Exception $e) { echo 'Exception when calling ScoreApi->updateScoreComment: ', $e->getMessage(), PHP_EOL; @@ -1556,7 +1556,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | **comment** | **string**| Unique identifier of a sheet music comment | - **body** | [**\Flat\APIClient\Model\ScoreCommentUpdate**](../Model/ScoreCommentUpdate.md)| | + **scoreCommentUpdate** | [**\Flat\APIClient\Model\ScoreCommentUpdate**](../Model/ScoreCommentUpdate.md)| | **sharingKey** | **string**| This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. | [optional] ### Return type @@ -1575,7 +1575,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) # **updateScoreTrack** -> \Flat\APIClient\Model\ScoreTrack updateScoreTrack($score, $track, $body) +> \Flat\APIClient\Model\ScoreTrack updateScoreTrack($score, $track, $scoreTrackUpdate) Update an audio or video track linked to a score @@ -1593,12 +1593,12 @@ $apiInstance = new Flat\APIClient\Api\ScoreApi( new GuzzleHttp\Client(), $config ); -$score = "score_example"; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). -$track = "track_example"; // string | Unique identifier of a score audio track -$body = new \Flat\APIClient\Model\ScoreTrackUpdate(); // \Flat\APIClient\Model\ScoreTrackUpdate | +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$track = 'track_example'; // string | Unique identifier of a score audio track +$scoreTrackUpdate = new \Flat\APIClient\Model\ScoreTrackUpdate(); // \Flat\APIClient\Model\ScoreTrackUpdate | try { - $result = $apiInstance->updateScoreTrack($score, $track, $body); + $result = $apiInstance->updateScoreTrack($score, $track, $scoreTrackUpdate); print_r($result); } catch (Exception $e) { echo 'Exception when calling ScoreApi->updateScoreTrack: ', $e->getMessage(), PHP_EOL; @@ -1612,7 +1612,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | **track** | **string**| Unique identifier of a score audio track | - **body** | [**\Flat\APIClient\Model\ScoreTrackUpdate**](../Model/ScoreTrackUpdate.md)| | + **scoreTrackUpdate** | [**\Flat\APIClient\Model\ScoreTrackUpdate**](../Model/ScoreTrackUpdate.md)| | ### Return type diff --git a/docs/Api/UserApi.md b/docs/Api/UserApi.md index 88f6630..b34b5f7 100644 --- a/docs/Api/UserApi.md +++ b/docs/Api/UserApi.md @@ -28,8 +28,8 @@ $apiInstance = new Flat\APIClient\Api\UserApi( new GuzzleHttp\Client(), $config ); -$user = "user_example"; // string | Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. -$ids = true; // bool | Return only the identifiers of the scores +$user = 'user_example'; // string | Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. +$ids = True; // bool | Return only the identifiers of the scores try { $result = $apiInstance->gerUserLikes($user, $ids); @@ -57,7 +57,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -83,7 +83,7 @@ $apiInstance = new Flat\APIClient\Api\UserApi( new GuzzleHttp\Client(), $config ); -$user = "user_example"; // string | This route parameter is the unique identifier of the user. You can specify an email instead of an unique identifier. If you are executing this request authenticated, you can use `me` as a value instead of the current User unique identifier to work on the current authenticated user. +$user = 'user_example'; // string | This route parameter is the unique identifier of the user. You can specify an email instead of an unique identifier. If you are executing this request authenticated, you can use `me` as a value instead of the current User unique identifier to work on the current authenticated user. try { $result = $apiInstance->getUser($user); @@ -110,7 +110,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) @@ -136,8 +136,8 @@ $apiInstance = new Flat\APIClient\Api\UserApi( new GuzzleHttp\Client(), $config ); -$user = "user_example"; // string | Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. -$parent = "parent_example"; // string | Filter the score forked from the score id `parent` +$user = 'user_example'; // string | Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. +$parent = 'parent_example'; // string | Filter the score forked from the score id `parent` try { $result = $apiInstance->getUserScores($user, $parent); @@ -165,7 +165,7 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) diff --git a/docs/Model/ClassDetailsCanvas.md b/docs/Model/ClassDetailsCanvas.md index 330db79..e3911b2 100644 --- a/docs/Model/ClassDetailsCanvas.md +++ b/docs/Model/ClassDetailsCanvas.md @@ -3,8 +3,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | Unique identifier of the course on Canvas | [optional] **domain** | **string** | Canvas instance domain (e.g. \"canvas.instructure.com\") | [optional] +**id** | **string** | Unique identifier of the course on Canvas | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/Model/ClassDetailsClever.md b/docs/Model/ClassDetailsClever.md index 2a9c8a0..79b7f96 100644 --- a/docs/Model/ClassDetailsClever.md +++ b/docs/Model/ClassDetailsClever.md @@ -3,13 +3,13 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | Clever section unique identifier | [optional] -**creationDate** | [**\DateTime**](\DateTime.md) | The creation date of the section on clever | [optional] **modificationDate** | [**\DateTime**](\DateTime.md) | The last modification date of the section on clever | [optional] +**termEndDate** | [**\DateTime**](\DateTime.md) | End date of the term | [optional] **subject** | **string** | Normalized subject of the course | [optional] -**termName** | **string** | Name of the term when this course happens | [optional] **termStartDate** | [**\DateTime**](\DateTime.md) | Beginning date of the term | [optional] -**termEndDate** | [**\DateTime**](\DateTime.md) | End date of the term | [optional] +**id** | **string** | Clever section unique identifier | [optional] +**creationDate** | [**\DateTime**](\DateTime.md) | The creation date of the section on clever | [optional] +**termName** | **string** | Name of the term when this course happens | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/Model/ClassDetailsGoogleClassroom.md b/docs/Model/ClassDetailsGoogleClassroom.md index a3e1dd4..2f42294 100644 --- a/docs/Model/ClassDetailsGoogleClassroom.md +++ b/docs/Model/ClassDetailsGoogleClassroom.md @@ -3,10 +3,10 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | The course identifier on Google Classroom | [optional] -**alternateLink** | **string** | Absolute link to this course in the Classroom web UI | [optional] **name** | **string** | The name of the course on Google Classroom | [optional] +**alternateLink** | **string** | Absolute link to this course in the Classroom web UI | [optional] **section** | **string** | The section of the course on Google Classroom | [optional] +**id** | **string** | The course identifier on Google Classroom | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/Model/Collection.md b/docs/Model/Collection.md index 4535336..ca5dde9 100644 --- a/docs/Model/Collection.md +++ b/docs/Model/Collection.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **string** | Unique identifier of the collection | [optional] -**title** | [**\Flat\APIClient\Model\CollectionTitle**](CollectionTitle.md) | | [optional] +**title** | **string** | The title of the collection | [optional] **htmlUrl** | **string** | The url where the collection can be viewed in a web browser | [optional] **type** | [**\Flat\APIClient\Model\CollectionType**](CollectionType.md) | | [optional] **privacy** | [**\Flat\APIClient\Model\CollectionPrivacy**](CollectionPrivacy.md) | | [optional] diff --git a/docs/Model/CollectionCapabilities.md b/docs/Model/CollectionCapabilities.md index ed5d413..e1a1d30 100644 --- a/docs/Model/CollectionCapabilities.md +++ b/docs/Model/CollectionCapabilities.md @@ -3,11 +3,11 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**canDeleteScores** | **bool** | Whether the current user can delete scores from the collection If this collection has the `type` `trash`, this property will be set to `false`. Use `POST /v2/scores/{score}/untrash` to restore a score. | [optional] +**canAddScores** | **bool** | Whether the current user can add scores to the collection If this collection has the `type` `trash`, this property will be set to `false`. Use `DELETE /v2/scores/{score}` to trash a score. | [optional] **canEdit** | **bool** | Whether the current user can modify the metadata for the collection | [optional] **canShare** | **bool** | Whether the current user can modify the sharing settings for the collection | [optional] **canDelete** | **bool** | Whether the current user can delete the collection | [optional] -**canAddScores** | **bool** | Whether the current user can add scores to the collection If this collection has the `type` `trash`, this property will be set to `false`. Use `DELETE /v2/scores/{score}` to trash a score. | [optional] -**canDeleteScores** | **bool** | Whether the current user can delete scores from the collection If this collection has the `type` `trash`, this property will be set to `false`. Use `POST /v2/scores/{score}/untrash` to restore a score. | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/Model/CollectionCreation.md b/docs/Model/CollectionCreation.md index a52a0de..3e759b5 100644 --- a/docs/Model/CollectionCreation.md +++ b/docs/Model/CollectionCreation.md @@ -3,7 +3,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**title** | [**\Flat\APIClient\Model\CollectionTitle**](CollectionTitle.md) | | +**title** | **string** | The title of the collection | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/Model/CollectionModification.md b/docs/Model/CollectionModification.md index 1a423f9..c3d6b97 100644 --- a/docs/Model/CollectionModification.md +++ b/docs/Model/CollectionModification.md @@ -3,7 +3,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**title** | [**\Flat\APIClient\Model\CollectionTitle**](CollectionTitle.md) | | [optional] +**title** | **string** | The title of the collection | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/Model/ResourceCollaborator.md b/docs/Model/ResourceCollaborator.md index f184edd..58e8dff 100644 --- a/docs/Model/ResourceCollaborator.md +++ b/docs/Model/ResourceCollaborator.md @@ -3,9 +3,6 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**aclRead** | **bool** | `True` if the current user can read the current document | [optional] [default to false] -**aclWrite** | **bool** | `True` if the current user can modify the current document. If this is a right of a Collection, the capabilities of the associated user can be lower than this permission, check out the `capabilities` property as the end-user to have the complete possibilities with the collection. | [optional] [default to false] -**aclAdmin** | **bool** | `True` if the current user can manage the current document (i.e. share, delete) If this is a right of a Collection, the capabilities of the associated user can be lower than this permission, check out the `capabilities` property as the end-user to have the complete possibilities with the collection. | [optional] [default to false] **id** | **string** | The unique identifier of the permission | [optional] **score** | **string** | If this object is a permission of a score, this property will contain the unique identifier of the score | [optional] **collection** | **string** | If this object is a permission of a collection, this property will contain the unique identifier of the collection | [optional] diff --git a/docs/Model/ScoreCreation.md b/docs/Model/ScoreCreation.md index a8c4fac..e73f0b1 100644 --- a/docs/Model/ScoreCreation.md +++ b/docs/Model/ScoreCreation.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **title** | **string** | The title of the new score. If the title is too long, the API may trim this one. If this title is not specified, the API will try to (in this order): - Use the name of the file for files from a specified `source` (e.g. Google Drive) - Use the title contained in the file (e.g. [`movement-title`](https://usermanuals.musicxml.com/MusicXML/Content/EL-MusicXML-movement-title.htm) or [`credit-words`](https://usermanuals.musicxml.com/MusicXML/Content/EL-MusicXML-credit-words.htm) for [MusicXML](http://www.musicxml.com/) files). - Set a default title (e.g. \"New Music Score\") | [optional] **privacy** | [**\Flat\APIClient\Model\ScorePrivacy**](ScorePrivacy.md) | | -**data** | [**\Flat\APIClient\Model\ScoreData**](ScoreData.md) | | [optional] +**data** | **string** | The data of the score file. It must be a MusicXML 3 file (`vnd.recordare.musicxml` or `vnd.recordare.musicxml+xml`), a MIDI file (`audio/midi`) or a Flat.json (aka Adagio.json) file. Binary payloads (`vnd.recordare.musicxml` and `audio/midi`) can be encoded in Base64, in this case the `dataEncoding` property must match the encoding used for the API request. | [optional] **dataEncoding** | [**\Flat\APIClient\Model\ScoreDataEncoding**](ScoreDataEncoding.md) | | [optional] **source** | [**\Flat\APIClient\Model\ScoreSource**](ScoreSource.md) | | [optional] **collection** | **string** | Unique identifier of a collection where the score will be created. If no collection identifier is provided, the score will be stored in the `root` directory. | [optional] diff --git a/docs/Model/ScoreDetails.md b/docs/Model/ScoreDetails.md index cf03bfb..555189d 100644 --- a/docs/Model/ScoreDetails.md +++ b/docs/Model/ScoreDetails.md @@ -3,12 +3,6 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | The unique identifier of the score | [optional] -**sharingKey** | **string** | The private sharing key of the score (available when the `privacy` mode is set to `privateLink`) | [optional] -**title** | **string** | The title of the score | [optional] -**privacy** | [**\Flat\APIClient\Model\ScorePrivacy**](ScorePrivacy.md) | | [optional] -**user** | [**\Flat\APIClient\Model\UserPublicSummary**](UserPublicSummary.md) | | [optional] -**htmlUrl** | **string** | The url where the score can be viewed in a web browser | [optional] **subtitle** | **string** | Subtitle of the score | [optional] **lyricist** | **string** | Lyricist of the score | [optional] **composer** | **string** | Composer of the score | [optional] diff --git a/docs/Model/ScoreModification.md b/docs/Model/ScoreModification.md index d4cf0ff..a360636 100644 --- a/docs/Model/ScoreModification.md +++ b/docs/Model/ScoreModification.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **title** | **string** | The title of the score | [optional] **privacy** | [**\Flat\APIClient\Model\ScorePrivacy**](ScorePrivacy.md) | | [optional] -**sharingKey** | [**\Flat\APIClient\Model\ResourceSharingKey**](ResourceSharingKey.md) | | [optional] +**sharingKey** | **string** | When using the `privacy` mode `privateLink`, this property can be used to set a custom sharing key, otherwise a new key will be generated. | [optional] **description** | **string** | Description of the creation | [optional] **tags** | **string[]** | Tags describing the score | [optional] **creationType** | [**\Flat\APIClient\Model\ScoreCreationType**](ScoreCreationType.md) | | [optional] diff --git a/docs/Model/ScoreRevisionCreation.md b/docs/Model/ScoreRevisionCreation.md index 414e318..79294f5 100644 --- a/docs/Model/ScoreRevisionCreation.md +++ b/docs/Model/ScoreRevisionCreation.md @@ -3,7 +3,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**data** | [**\Flat\APIClient\Model\ScoreData**](ScoreData.md) | | +**data** | **string** | The data of the score file. It must be a MusicXML 3 file (`vnd.recordare.musicxml` or `vnd.recordare.musicxml+xml`), a MIDI file (`audio/midi`) or a Flat.json (aka Adagio.json) file. Binary payloads (`vnd.recordare.musicxml` and `audio/midi`) can be encoded in Base64, in this case the `dataEncoding` property must match the encoding used for the API request. | **dataEncoding** | [**\Flat\APIClient\Model\ScoreDataEncoding**](ScoreDataEncoding.md) | | [optional] **autosave** | **bool** | Must be set to `true` if the revision was created automatically. | [optional] **description** | **string** | A description associated to the revision | [optional] diff --git a/docs/Model/UserDetailsAdmin.md b/docs/Model/UserDetailsAdmin.md index 31963ce..e4cc4d1 100644 --- a/docs/Model/UserDetailsAdmin.md +++ b/docs/Model/UserDetailsAdmin.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **email** | **string** | Email of the user | [optional] **lastActivityDate** | [**\DateTime**](\DateTime.md) | Date of the last user activity | [optional] -**license** | [**\Flat\APIClient\Model\UserDetailsAdminLicense**](UserDetailsAdminLicense.md) | | [optional] +**license** | **object** | Current active license of the user | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/reference/Api/AccountApi.md b/docs/reference/Api/AccountApi.md new file mode 100644 index 0000000..0f4133e --- /dev/null +++ b/docs/reference/Api/AccountApi.md @@ -0,0 +1,68 @@ +# Flat\APIClient\AccountApi + +All URIs are relative to https://api.flat.io/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**getAuthenticatedUser()**](AccountApi.md#getAuthenticatedUser) | **GET** /me | Get current user account | + + +## `getAuthenticatedUser()` + +```php +getAuthenticatedUser($only_id): \Flat\APIClient\Model\UserDetails +``` + +Get current user account + +Get details about the current authenticated User. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\AccountApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$only_id = false; // bool | Only return the user id + +try { + $result = $apiInstance->getAuthenticatedUser($only_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AccountApi->getAuthenticatedUser: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **only_id** | **bool**| Only return the user id | [optional] [default to false] | + +### Return type + +[**\Flat\APIClient\Model\UserDetails**](../Model/UserDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/reference/Api/ClassApi.md b/docs/reference/Api/ClassApi.md new file mode 100644 index 0000000..51d4a7a --- /dev/null +++ b/docs/reference/Api/ClassApi.md @@ -0,0 +1,2078 @@ +# Flat\APIClient\ClassApi + +All URIs are relative to https://api.flat.io/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**activateClass()**](ClassApi.md#activateClass) | **POST** /classes/{class}/activate | Activate the class | +| [**addClassUser()**](ClassApi.md#addClassUser) | **PUT** /classes/{class}/users/{user} | Add a user to the class | +| [**archiveAssignment()**](ClassApi.md#archiveAssignment) | **POST** /classes/{class}/assignments/{assignment}/archive | Archive the assignment | +| [**archiveClass()**](ClassApi.md#archiveClass) | **POST** /classes/{class}/archive | Archive the class | +| [**copyAssignment()**](ClassApi.md#copyAssignment) | **POST** /classes/{class}/assignments/{assignment}/copy | Copy an assignment | +| [**createClass()**](ClassApi.md#createClass) | **POST** /classes | Create a new class | +| [**createClassAssignment()**](ClassApi.md#createClassAssignment) | **POST** /classes/{class}/assignments | Assignment creation | +| [**createSubmission()**](ClassApi.md#createSubmission) | **PUT** /classes/{class}/assignments/{assignment}/submissions | Create or edit a submission | +| [**createTestStudentAccount()**](ClassApi.md#createTestStudentAccount) | **POST** /classes/{class}/testStudent | Create a test student account | +| [**deleteAssignment()**](ClassApi.md#deleteAssignment) | **DELETE** /classes/{class}/assignments/{assignment} | Delete an assignment | +| [**deleteClassUser()**](ClassApi.md#deleteClassUser) | **DELETE** /classes/{class}/users/{user} | Remove a user from the class | +| [**deleteSubmission()**](ClassApi.md#deleteSubmission) | **DELETE** /classes/{class}/assignments/{assignment}/submissions/{submission} | Reset a submission | +| [**deleteSubmissionComment()**](ClassApi.md#deleteSubmissionComment) | **DELETE** /classes/{class}/assignments/{assignment}/submissions/{submission}/comments/{comment} | Delete a feedback comment to a submission | +| [**editSubmission()**](ClassApi.md#editSubmission) | **PUT** /classes/{class}/assignments/{assignment}/submissions/{submission} | Edit a submission | +| [**enrollClass()**](ClassApi.md#enrollClass) | **POST** /classes/enroll/{enrollmentCode} | Join a class | +| [**exportSubmissionsReviewsAsCsv()**](ClassApi.md#exportSubmissionsReviewsAsCsv) | **GET** /classes/{class}/assignments/{assignment}/submissions/csv | CSV Grades exports | +| [**exportSubmissionsReviewsAsExcel()**](ClassApi.md#exportSubmissionsReviewsAsExcel) | **GET** /classes/{class}/assignments/{assignment}/submissions/excel | Excel Grades exports | +| [**getAssignment()**](ClassApi.md#getAssignment) | **GET** /classes/{class}/assignments/{assignment} | Get an assignment | +| [**getClass()**](ClassApi.md#getClass) | **GET** /classes/{class} | Get the details of a single class | +| [**getScoreSubmissions()**](ClassApi.md#getScoreSubmissions) | **GET** /scores/{score}/submissions | List submissions related to the score | +| [**getSubmission()**](ClassApi.md#getSubmission) | **GET** /classes/{class}/assignments/{assignment}/submissions/{submission} | Get a student submission | +| [**getSubmissionComments()**](ClassApi.md#getSubmissionComments) | **GET** /classes/{class}/assignments/{assignment}/submissions/{submission}/comments | List the feedback comments of a submission | +| [**getSubmissionHistory()**](ClassApi.md#getSubmissionHistory) | **GET** /classes/{class}/assignments/{assignment}/submissions/{submission}/history | Get the history of the submission | +| [**getSubmissions()**](ClassApi.md#getSubmissions) | **GET** /classes/{class}/assignments/{assignment}/submissions | List the students' submissions | +| [**listAssignments()**](ClassApi.md#listAssignments) | **GET** /classes/{class}/assignments | Assignments listing | +| [**listClassStudentSubmissions()**](ClassApi.md#listClassStudentSubmissions) | **GET** /classes/{class}/students/{user}/submissions | List the submissions for a student | +| [**listClasses()**](ClassApi.md#listClasses) | **GET** /classes | List the classes available for the current user | +| [**postSubmissionComment()**](ClassApi.md#postSubmissionComment) | **POST** /classes/{class}/assignments/{assignment}/submissions/{submission}/comments | Add a feedback comment to a submission | +| [**unarchiveAssignment()**](ClassApi.md#unarchiveAssignment) | **DELETE** /classes/{class}/assignments/{assignment}/archive | Unarchive the assignment. | +| [**unarchiveClass()**](ClassApi.md#unarchiveClass) | **DELETE** /classes/{class}/archive | Unarchive the class | +| [**updateClass()**](ClassApi.md#updateClass) | **PUT** /classes/{class} | Update the class | +| [**updateClassAssignment()**](ClassApi.md#updateClassAssignment) | **PUT** /classes/{class}/assignments/{assignment} | Update an assignment | +| [**updateSubmissionComment()**](ClassApi.md#updateSubmissionComment) | **PUT** /classes/{class}/assignments/{assignment}/submissions/{submission}/comments/{comment} | Update a feedback comment to a submission | + + +## `activateClass()` + +```php +activateClass($class): \Flat\APIClient\Model\ClassDetails +``` + +Activate the class + +Mark the class as `active`. This is mainly used for classes synchronized from Clever that are initially with an `inactive` state and hidden in the UI. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class + +try { + $result = $apiInstance->activateClass($class); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->activateClass: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | + +### Return type + +[**\Flat\APIClient\Model\ClassDetails**](../Model/ClassDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `addClassUser()` + +```php +addClassUser($class, $user) +``` + +Add a user to the class + +This method can be used by a teacher of the class to enroll another Flat user into the class. Only users that are part of your Organization can be enrolled in a class of this same Organization. When enrolling a user in the class, Flat will automatically add this user to the corresponding Class group, based on this role in the Organization. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$user = 'user_example'; // string | Unique identifier of the user + +try { + $apiInstance->addClassUser($class, $user); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->addClassUser: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **user** | **string**| Unique identifier of the user | | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `archiveAssignment()` + +```php +archiveAssignment($class, $assignment): \Flat\APIClient\Model\Assignment +``` + +Archive the assignment + +Archive the assignment + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$assignment = 'assignment_example'; // string | Unique identifier of the assignment + +try { + $result = $apiInstance->archiveAssignment($class, $assignment); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->archiveAssignment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **assignment** | **string**| Unique identifier of the assignment | | + +### Return type + +[**\Flat\APIClient\Model\Assignment**](../Model/Assignment.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `archiveClass()` + +```php +archiveClass($class): \Flat\APIClient\Model\ClassDetails +``` + +Archive the class + +Mark the class as `archived`. When this course is synchronized with another app, like Google Classroom, this state will be automatically be updated. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class + +try { + $result = $apiInstance->archiveClass($class); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->archiveClass: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | + +### Return type + +[**\Flat\APIClient\Model\ClassDetails**](../Model/ClassDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `copyAssignment()` + +```php +copyAssignment($class, $assignment, $body): \Flat\APIClient\Model\AssignmentCopyResponse +``` + +Copy an assignment + +Copy an assignment to a specified class or the resource library For class assignments: - If the original assignment has a due date in the past, this new assignment will be created without a due date. - If the class is synchronized with an external app (e.g. Google Classroom), the copied assignment will also be posted on the external app. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$assignment = 'assignment_example'; // string | Unique identifier of the assignment +$body = new \Flat\APIClient\Model\AssignmentCopyToClass(); // \Flat\APIClient\Model\AssignmentCopy + +try { + $result = $apiInstance->copyAssignment($class, $assignment, $body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->copyAssignment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **assignment** | **string**| Unique identifier of the assignment | | +| **body** | [**\Flat\APIClient\Model\AssignmentCopy**](../Model/AssignmentCopy.md)| | | + +### Return type + +[**\Flat\APIClient\Model\AssignmentCopyResponse**](../Model/AssignmentCopyResponse.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createClass()` + +```php +createClass($body): \Flat\APIClient\Model\ClassDetails +``` + +Create a new class + +Classrooms on Flat allow you to create activities with assignments and post content to a specific group. When creating a class, Flat automatically creates two groups: one for the teachers of the course, one for the students. The creator of this class is automatically added to the teachers group. If the classsroom is synchronized with another application like Google Classroom, some of the meta information will automatically be updated. You can add users to this class using `PUT /classes/{class}/users/{user}`, they will automatically added to the group based on their role on Flat. Users can also enroll themselves to this class using `POST /classes/enroll/{enrollmentCode}` and the `enrollmentCode` returned in the `ClassDetails` response. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$body = new \Flat\APIClient\Model\ClassCreation(); // \Flat\APIClient\Model\ClassCreation + +try { + $result = $apiInstance->createClass($body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->createClass: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **body** | [**\Flat\APIClient\Model\ClassCreation**](../Model/ClassCreation.md)| | | + +### Return type + +[**\Flat\APIClient\Model\ClassDetails**](../Model/ClassDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createClassAssignment()` + +```php +createClassAssignment($class, $body): \Flat\APIClient\Model\Assignment +``` + +Assignment creation + +Use this method as a teacher to create and post a new assignment to a class. If the class is synchronized with Google Classroom, the assignment will be automatically posted to your Classroom course. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$body = new \Flat\APIClient\Model\ClassAssignmentUpdate(); // \Flat\APIClient\Model\ClassAssignmentUpdate + +try { + $result = $apiInstance->createClassAssignment($class, $body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->createClassAssignment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **body** | [**\Flat\APIClient\Model\ClassAssignmentUpdate**](../Model/ClassAssignmentUpdate.md)| | | + +### Return type + +[**\Flat\APIClient\Model\Assignment**](../Model/Assignment.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createSubmission()` + +```php +createSubmission($class, $assignment, $body): \Flat\APIClient\Model\AssignmentSubmission +``` + +Create or edit a submission + +Use this method as a student to create, update and submit a submission related to an assignment. Students can only set `attachments` and `submit`. Teachers can use `PUT /classes/{class}/assignments/{assignment}/submissions/{submission}` to update a submission by id. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$assignment = 'assignment_example'; // string | Unique identifier of the assignment +$body = new \Flat\APIClient\Model\AssignmentSubmissionUpdate(); // \Flat\APIClient\Model\AssignmentSubmissionUpdate + +try { + $result = $apiInstance->createSubmission($class, $assignment, $body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->createSubmission: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **assignment** | **string**| Unique identifier of the assignment | | +| **body** | [**\Flat\APIClient\Model\AssignmentSubmissionUpdate**](../Model/AssignmentSubmissionUpdate.md)| | | + +### Return type + +[**\Flat\APIClient\Model\AssignmentSubmission**](../Model/AssignmentSubmission.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createTestStudentAccount()` + +```php +createTestStudentAccount($class, $reset): \Flat\APIClient\Model\UserDetails +``` + +Create a test student account + +Test students account can be created by teachers an admin and be used to experiment the assignments. - They are automatically added to the class. - They can be reset using this API endpoint (a new account will be created and the previous one scheduled for deletion). - These accounts don't use a user license. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$reset = True; // bool | If true, the testing account will be re-created. + +try { + $result = $apiInstance->createTestStudentAccount($class, $reset); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->createTestStudentAccount: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **reset** | **bool**| If true, the testing account will be re-created. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\UserDetails**](../Model/UserDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteAssignment()` + +```php +deleteAssignment($class, $assignment) +``` + +Delete an assignment + +Delete an assignment. This cannot be undone, and it removes a good deal more than the assignment itself: every submission made against it, the students' dedicated copies of the attached scores, the related class stream posts and notifications, and the editor toolset. When the class is synchronized with Google Classroom or Microsoft Teams, the assignment is deleted there too. Requires the teacher role on the class, and the class must not be archived. `archiveAssignment` is almost always what you want instead: it takes the assignment out of the class stream and keeps the submissions and their grades. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$assignment = 'assignment_example'; // string | Unique identifier of the assignment + +try { + $apiInstance->deleteAssignment($class, $assignment); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->deleteAssignment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **assignment** | **string**| Unique identifier of the assignment | | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteClassUser()` + +```php +deleteClassUser($class, $user) +``` + +Remove a user from the class + +This method can be used by a teacher of the class to remove another user from it. Removing your own account is not allowed. Warning: Removing a user from the class will remove the associated resources, including the submissions and feedback related to these submissions. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$user = 'user_example'; // string | Unique identifier of the user + +try { + $apiInstance->deleteClassUser($class, $user); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->deleteClassUser: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **user** | **string**| Unique identifier of the user | | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteSubmission()` + +```php +deleteSubmission($class, $assignment, $submission): \Flat\APIClient\Model\AssignmentSubmission +``` + +Reset a submission + +Use this method as a teacher to reset a submission and allow student to start over the assignment + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$assignment = 'assignment_example'; // string | Unique identifier of the assignment +$submission = 'submission_example'; // string | Unique identifier of the submission + +try { + $result = $apiInstance->deleteSubmission($class, $assignment, $submission); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->deleteSubmission: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **assignment** | **string**| Unique identifier of the assignment | | +| **submission** | **string**| Unique identifier of the submission | | + +### Return type + +[**\Flat\APIClient\Model\AssignmentSubmission**](../Model/AssignmentSubmission.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteSubmissionComment()` + +```php +deleteSubmissionComment($class, $assignment, $submission, $comment) +``` + +Delete a feedback comment to a submission + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$assignment = 'assignment_example'; // string | Unique identifier of the assignment +$submission = 'submission_example'; // string | Unique identifier of the submission +$comment = 'comment_example'; // string | Unique identifier of the comment + +try { + $apiInstance->deleteSubmissionComment($class, $assignment, $submission, $comment); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->deleteSubmissionComment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **assignment** | **string**| Unique identifier of the assignment | | +| **submission** | **string**| Unique identifier of the submission | | +| **comment** | **string**| Unique identifier of the comment | | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `editSubmission()` + +```php +editSubmission($class, $assignment, $submission, $body): \Flat\APIClient\Model\AssignmentSubmission +``` + +Edit a submission + +Use this method as a teacher to update the different submission and give feedback. Teachers can only set `return`, `draftGrade` and `grade` + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$assignment = 'assignment_example'; // string | Unique identifier of the assignment +$submission = 'submission_example'; // string | Unique identifier of the submission +$body = new \Flat\APIClient\Model\AssignmentSubmissionUpdate(); // \Flat\APIClient\Model\AssignmentSubmissionUpdate + +try { + $result = $apiInstance->editSubmission($class, $assignment, $submission, $body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->editSubmission: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **assignment** | **string**| Unique identifier of the assignment | | +| **submission** | **string**| Unique identifier of the submission | | +| **body** | [**\Flat\APIClient\Model\AssignmentSubmissionUpdate**](../Model/AssignmentSubmissionUpdate.md)| | | + +### Return type + +[**\Flat\APIClient\Model\AssignmentSubmission**](../Model/AssignmentSubmission.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `enrollClass()` + +```php +enrollClass($enrollment_code): \Flat\APIClient\Model\ClassDetails +``` + +Join a class + +Use this method to join a class using an enrollment code given one of the teacher of this class. This code is also available in the `ClassDetails` returned to the teachers when creating the class or listing / fetching a specific class. Flat will automatically add the user to the corresponding class group based on this role in the organization. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$enrollment_code = 'enrollment_code_example'; // string | The enrollment code, available to the teacher in `ClassDetails` + +try { + $result = $apiInstance->enrollClass($enrollment_code); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->enrollClass: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **enrollment_code** | **string**| The enrollment code, available to the teacher in `ClassDetails` | | + +### Return type + +[**\Flat\APIClient\Model\ClassDetails**](../Model/ClassDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `exportSubmissionsReviewsAsCsv()` + +```php +exportSubmissionsReviewsAsCsv($class, $assignment): \SplFileObject +``` + +CSV Grades exports + +Export list of submissions grades to a CSV file + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$assignment = 'assignment_example'; // string | Unique identifier of the assignment + +try { + $result = $apiInstance->exportSubmissionsReviewsAsCsv($class, $assignment); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->exportSubmissionsReviewsAsCsv: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **assignment** | **string**| Unique identifier of the assignment | | + +### Return type + +**\SplFileObject** + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `text/csv` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `exportSubmissionsReviewsAsExcel()` + +```php +exportSubmissionsReviewsAsExcel($class, $assignment): \SplFileObject +``` + +Excel Grades exports + +Export list of submissions grades to an Excel file + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$assignment = 'assignment_example'; // string | Unique identifier of the assignment + +try { + $result = $apiInstance->exportSubmissionsReviewsAsExcel($class, $assignment); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->exportSubmissionsReviewsAsExcel: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **assignment** | **string**| Unique identifier of the assignment | | + +### Return type + +**\SplFileObject** + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getAssignment()` + +```php +getAssignment($class, $assignment): \Flat\APIClient\Model\Assignment +``` + +Get an assignment + +Retrieve a single assignment, including its attachments, its toolset and its grading settings. Use `listAssignments` to enumerate the assignments of a class. A teacher of the class sees the assignment as authored. A student sees the same document with the teacher-only fields omitted, `teacherInstructions` among them. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$assignment = 'assignment_example'; // string | Unique identifier of the assignment + +try { + $result = $apiInstance->getAssignment($class, $assignment); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->getAssignment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **assignment** | **string**| Unique identifier of the assignment | | + +### Return type + +[**\Flat\APIClient\Model\Assignment**](../Model/Assignment.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getClass()` + +```php +getClass($class): \Flat\APIClient\Model\ClassDetails +``` + +Get the details of a single class + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class + +try { + $result = $apiInstance->getClass($class); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->getClass: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | + +### Return type + +[**\Flat\APIClient\Model\ClassDetails**](../Model/ClassDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getScoreSubmissions()` + +```php +getScoreSubmissions($score): \Flat\APIClient\Model\AssignmentSubmission[] +``` + +List submissions related to the score + +This API call will list the different assignments submissions where the score is attached. This method can be used by anyone that are part of the organization and have at least read access to the document. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). + +try { + $result = $apiInstance->getScoreSubmissions($score); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->getScoreSubmissions: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | + +### Return type + +[**\Flat\APIClient\Model\AssignmentSubmission[]**](../Model/AssignmentSubmission.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getSubmission()` + +```php +getSubmission($class, $assignment, $submission): \Flat\APIClient\Model\AssignmentSubmission +``` + +Get a student submission + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$assignment = 'assignment_example'; // string | Unique identifier of the assignment +$submission = 'submission_example'; // string | Unique identifier of the submission + +try { + $result = $apiInstance->getSubmission($class, $assignment, $submission); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->getSubmission: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **assignment** | **string**| Unique identifier of the assignment | | +| **submission** | **string**| Unique identifier of the submission | | + +### Return type + +[**\Flat\APIClient\Model\AssignmentSubmission**](../Model/AssignmentSubmission.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getSubmissionComments()` + +```php +getSubmissionComments($class, $assignment, $submission): \Flat\APIClient\Model\AssignmentSubmissionComment[] +``` + +List the feedback comments of a submission + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$assignment = 'assignment_example'; // string | Unique identifier of the assignment +$submission = 'submission_example'; // string | Unique identifier of the submission + +try { + $result = $apiInstance->getSubmissionComments($class, $assignment, $submission); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->getSubmissionComments: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **assignment** | **string**| Unique identifier of the assignment | | +| **submission** | **string**| Unique identifier of the submission | | + +### Return type + +[**\Flat\APIClient\Model\AssignmentSubmissionComment[]**](../Model/AssignmentSubmissionComment.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getSubmissionHistory()` + +```php +getSubmissionHistory($class, $assignment, $submission): \Flat\APIClient\Model\AssignmentSubmissionHistory[] +``` + +Get the history of the submission + +For teachers only. Returns a detailed history of the submission. This currently includes state and grade histories. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$assignment = 'assignment_example'; // string | Unique identifier of the assignment +$submission = 'submission_example'; // string | Unique identifier of the submission + +try { + $result = $apiInstance->getSubmissionHistory($class, $assignment, $submission); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->getSubmissionHistory: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **assignment** | **string**| Unique identifier of the assignment | | +| **submission** | **string**| Unique identifier of the submission | | + +### Return type + +[**\Flat\APIClient\Model\AssignmentSubmissionHistory[]**](../Model/AssignmentSubmissionHistory.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getSubmissions()` + +```php +getSubmissions($class, $assignment): \Flat\APIClient\Model\AssignmentSubmission[] +``` + +List the students' submissions + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$assignment = 'assignment_example'; // string | Unique identifier of the assignment + +try { + $result = $apiInstance->getSubmissions($class, $assignment); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->getSubmissions: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **assignment** | **string**| Unique identifier of the assignment | | + +### Return type + +[**\Flat\APIClient\Model\AssignmentSubmission[]**](../Model/AssignmentSubmission.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listAssignments()` + +```php +listAssignments($class): \Flat\APIClient\Model\ClassAssignment[] +``` + +Assignments listing + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class + +try { + $result = $apiInstance->listAssignments($class); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->listAssignments: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | + +### Return type + +[**\Flat\APIClient\Model\ClassAssignment[]**](../Model/ClassAssignment.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listClassStudentSubmissions()` + +```php +listClassStudentSubmissions($class, $user): \Flat\APIClient\Model\AssignmentSubmission[] +``` + +List the submissions for a student + +Use this method as a teacher to list all the assignment submissions sent by a student of the class + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$user = 'user_example'; // string | Unique identifier of the user + +try { + $result = $apiInstance->listClassStudentSubmissions($class, $user); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->listClassStudentSubmissions: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **user** | **string**| Unique identifier of the user | | + +### Return type + +[**\Flat\APIClient\Model\AssignmentSubmission[]**](../Model/AssignmentSubmission.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listClasses()` + +```php +listClasses($state): \Flat\APIClient\Model\ClassDetails[] +``` + +List the classes available for the current user + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$state = 'active'; // string | Filter the classes by state + +try { + $result = $apiInstance->listClasses($state); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->listClasses: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **state** | **string**| Filter the classes by state | [optional] [default to 'active'] | + +### Return type + +[**\Flat\APIClient\Model\ClassDetails[]**](../Model/ClassDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `postSubmissionComment()` + +```php +postSubmissionComment($class, $assignment, $submission, $assignment_submission_comment_creation): \Flat\APIClient\Model\AssignmentSubmissionComment +``` + +Add a feedback comment to a submission + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$assignment = 'assignment_example'; // string | Unique identifier of the assignment +$submission = 'submission_example'; // string | Unique identifier of the submission +$assignment_submission_comment_creation = new \Flat\APIClient\Model\AssignmentSubmissionCommentCreation(); // \Flat\APIClient\Model\AssignmentSubmissionCommentCreation + +try { + $result = $apiInstance->postSubmissionComment($class, $assignment, $submission, $assignment_submission_comment_creation); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->postSubmissionComment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **assignment** | **string**| Unique identifier of the assignment | | +| **submission** | **string**| Unique identifier of the submission | | +| **assignment_submission_comment_creation** | [**\Flat\APIClient\Model\AssignmentSubmissionCommentCreation**](../Model/AssignmentSubmissionCommentCreation.md)| | | + +### Return type + +[**\Flat\APIClient\Model\AssignmentSubmissionComment**](../Model/AssignmentSubmissionComment.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `unarchiveAssignment()` + +```php +unarchiveAssignment($class, $assignment): \Flat\APIClient\Model\Assignment +``` + +Unarchive the assignment. + +Mark the assignment as `active`. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$assignment = 'assignment_example'; // string | Unique identifier of the assignment + +try { + $result = $apiInstance->unarchiveAssignment($class, $assignment); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->unarchiveAssignment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **assignment** | **string**| Unique identifier of the assignment | | + +### Return type + +[**\Flat\APIClient\Model\Assignment**](../Model/Assignment.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `unarchiveClass()` + +```php +unarchiveClass($class): \Flat\APIClient\Model\ClassDetails +``` + +Unarchive the class + +Mark the class as `active`. When this course is synchronized with another app, like Google Classroom, this state will be automatically be updated. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class + +try { + $result = $apiInstance->unarchiveClass($class); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->unarchiveClass: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | + +### Return type + +[**\Flat\APIClient\Model\ClassDetails**](../Model/ClassDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateClass()` + +```php +updateClass($class, $body): \Flat\APIClient\Model\ClassDetails +``` + +Update the class + +Update the meta information of the class + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$body = new \Flat\APIClient\Model\ClassUpdate(); // \Flat\APIClient\Model\ClassUpdate | Details of the Class + +try { + $result = $apiInstance->updateClass($class, $body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->updateClass: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **body** | [**\Flat\APIClient\Model\ClassUpdate**](../Model/ClassUpdate.md)| Details of the Class | | + +### Return type + +[**\Flat\APIClient\Model\ClassDetails**](../Model/ClassDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateClassAssignment()` + +```php +updateClassAssignment($class, $assignment, $body): \Flat\APIClient\Model\Assignment +``` + +Update an assignment + +Update an assignment. Only the properties present in the request body are modified, so a partial body leaves everything else as it was. `attachments` is the exception: when present it replaces the whole list. Requires the teacher role on the class. The class must not be archived, and an assignment that is already `active` cannot be moved back to `draft`. Editing an assignment that students have already started does not reset their submissions. To take an assignment out of circulation while keeping the work, use `archiveAssignment`. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$assignment = 'assignment_example'; // string | Unique identifier of the assignment +$body = new \Flat\APIClient\Model\ClassAssignmentUpdate(); // \Flat\APIClient\Model\ClassAssignmentUpdate + +try { + $result = $apiInstance->updateClassAssignment($class, $assignment, $body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->updateClassAssignment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **assignment** | **string**| Unique identifier of the assignment | | +| **body** | [**\Flat\APIClient\Model\ClassAssignmentUpdate**](../Model/ClassAssignmentUpdate.md)| | | + +### Return type + +[**\Flat\APIClient\Model\Assignment**](../Model/Assignment.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateSubmissionComment()` + +```php +updateSubmissionComment($class, $assignment, $submission, $comment, $assignment_submission_comment_creation): \Flat\APIClient\Model\AssignmentSubmissionComment +``` + +Update a feedback comment to a submission + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ClassApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$class = 'class_example'; // string | Unique identifier of the class +$assignment = 'assignment_example'; // string | Unique identifier of the assignment +$submission = 'submission_example'; // string | Unique identifier of the submission +$comment = 'comment_example'; // string | Unique identifier of the comment +$assignment_submission_comment_creation = new \Flat\APIClient\Model\AssignmentSubmissionCommentCreation(); // \Flat\APIClient\Model\AssignmentSubmissionCommentCreation + +try { + $result = $apiInstance->updateSubmissionComment($class, $assignment, $submission, $comment, $assignment_submission_comment_creation); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClassApi->updateSubmissionComment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **class** | **string**| Unique identifier of the class | | +| **assignment** | **string**| Unique identifier of the assignment | | +| **submission** | **string**| Unique identifier of the submission | | +| **comment** | **string**| Unique identifier of the comment | | +| **assignment_submission_comment_creation** | [**\Flat\APIClient\Model\AssignmentSubmissionCommentCreation**](../Model/AssignmentSubmissionCommentCreation.md)| | | + +### Return type + +[**\Flat\APIClient\Model\AssignmentSubmissionComment**](../Model/AssignmentSubmissionComment.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/reference/Api/CollectionApi.md b/docs/reference/Api/CollectionApi.md new file mode 100644 index 0000000..7f21f82 --- /dev/null +++ b/docs/reference/Api/CollectionApi.md @@ -0,0 +1,586 @@ +# Flat\APIClient\CollectionApi + +All URIs are relative to https://api.flat.io/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**addScoreToCollection()**](CollectionApi.md#addScoreToCollection) | **PUT** /collections/{collection}/scores/{score} | Add a score to the collection | +| [**createCollection()**](CollectionApi.md#createCollection) | **POST** /collections | Create a new collection | +| [**deleteCollection()**](CollectionApi.md#deleteCollection) | **DELETE** /collections/{collection} | Delete the collection | +| [**deleteScoreFromCollection()**](CollectionApi.md#deleteScoreFromCollection) | **DELETE** /collections/{collection}/scores/{score} | Delete a score from the collection | +| [**editCollection()**](CollectionApi.md#editCollection) | **PUT** /collections/{collection} | Update a collection's metadata | +| [**getCollection()**](CollectionApi.md#getCollection) | **GET** /collections/{collection} | Get collection details | +| [**listCollectionScores()**](CollectionApi.md#listCollectionScores) | **GET** /collections/{collection}/scores | List the scores contained in a collection | +| [**listCollections()**](CollectionApi.md#listCollections) | **GET** /collections | List the collections | +| [**untrashCollection()**](CollectionApi.md#untrashCollection) | **POST** /collections/{collection}/untrash | Untrash a collection | + + +## `addScoreToCollection()` + +```php +addScoreToCollection($collection, $score, $sharing_key): \Flat\APIClient\Model\ScoreDetails +``` + +Add a score to the collection + +This operation will add a score to a collection. The default behavior will make the score available across multiple collections. You must have the capability `canAddScores` on the provided `collection` to perform the action. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\CollectionApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$collection = 'collection_example'; // string | Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$sharing_key = 'sharing_key_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. + +try { + $result = $apiInstance->addScoreToCollection($collection, $score, $sharing_key); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CollectionApi->addScoreToCollection: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **collection** | **string**| Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted | | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **sharing_key** | **string**| This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\ScoreDetails**](../Model/ScoreDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/x-www-form-urlencoded` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createCollection()` + +```php +createCollection($body): \Flat\APIClient\Model\Collection +``` + +Create a new collection + +This method will create a new collection in your account. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\CollectionApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$body = new \Flat\APIClient\Model\CollectionCreation(); // \Flat\APIClient\Model\CollectionCreation + +try { + $result = $apiInstance->createCollection($body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CollectionApi->createCollection: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **body** | [**\Flat\APIClient\Model\CollectionCreation**](../Model/CollectionCreation.md)| | | + +### Return type + +[**\Flat\APIClient\Model\Collection**](../Model/Collection.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteCollection()` + +```php +deleteCollection($collection) +``` + +Delete the collection + +This method will schedule the deletion of the collection. Until deleted, the collection will be available in the `trash`. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\CollectionApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$collection = 'collection_example'; // string | Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores + +try { + $apiInstance->deleteCollection($collection); +} catch (Exception $e) { + echo 'Exception when calling CollectionApi->deleteCollection: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **collection** | **string**| Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores | | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteScoreFromCollection()` + +```php +deleteScoreFromCollection($collection, $score, $event_properties, $sharing_key) +``` + +Delete a score from the collection + +This method will delete a score from the collection. Unlike [`DELETE /scores/{score}`](#operation/deleteScore), this score will not remove the score from your account, but only from the collection. This can be used to *move* a score from one collection to another, or simply remove a score from one collection when this one is contained in multiple collections. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\CollectionApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$collection = 'collection_example'; // string | Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$event_properties = {"context":"discover","screenLevel0":"home","screenRoute":"/discover"}; // string | Optional analytics properties merged into XP tracking for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` +$sharing_key = 'sharing_key_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. + +try { + $apiInstance->deleteScoreFromCollection($collection, $score, $event_properties, $sharing_key); +} catch (Exception $e) { + echo 'Exception when calling CollectionApi->deleteScoreFromCollection: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **collection** | **string**| Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted | | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **event_properties** | **string**| Optional analytics properties merged into XP tracking for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` | [optional] | +| **sharing_key** | **string**| This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/x-www-form-urlencoded` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `editCollection()` + +```php +editCollection($collection, $body): \Flat\APIClient\Model\Collection +``` + +Update a collection's metadata + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\CollectionApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$collection = 'collection_example'; // string | Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores +$body = new \Flat\APIClient\Model\CollectionModification(); // \Flat\APIClient\Model\CollectionModification + +try { + $result = $apiInstance->editCollection($collection, $body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CollectionApi->editCollection: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **collection** | **string**| Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores | | +| **body** | [**\Flat\APIClient\Model\CollectionModification**](../Model/CollectionModification.md)| | | + +### Return type + +[**\Flat\APIClient\Model\Collection**](../Model/Collection.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getCollection()` + +```php +getCollection($collection, $sharing_key): \Flat\APIClient\Model\Collection +``` + +Get collection details + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\CollectionApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$collection = 'collection_example'; // string | Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores +$sharing_key = 'sharing_key_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. + +try { + $result = $apiInstance->getCollection($collection, $sharing_key); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CollectionApi->getCollection: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **collection** | **string**| Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores | | +| **sharing_key** | **string**| This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\Collection**](../Model/Collection.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listCollectionScores()` + +```php +listCollectionScores($collection, $sort, $direction, $limit, $next, $previous, $sharing_key): \Flat\APIClient\Model\ScoreDetails[] +``` + +List the scores contained in a collection + +Use this method to list the scores contained in a collection. If no sort option is provided, the scores are sorted by `modificationDate` `desc`. For example, to list the scores contained in your app collection, you can use `GET /v2/collections/app/scores`. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\CollectionApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$collection = 'collection_example'; // string | Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores +$sort = 'sort_example'; // string | Sort +$direction = 'direction_example'; // string | Sort direction +$limit = 25; // int | This is the maximum number of objects that may be returned +$next = 'next_example'; // string | An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$previous = 'previous_example'; // string | An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$sharing_key = 'sharing_key_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. + +try { + $result = $apiInstance->listCollectionScores($collection, $sort, $direction, $limit, $next, $previous, $sharing_key); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CollectionApi->listCollectionScores: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **collection** | **string**| Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores | | +| **sort** | **string**| Sort | [optional] | +| **direction** | **string**| Sort direction | [optional] | +| **limit** | **int**| This is the maximum number of objects that may be returned | [optional] [default to 25] | +| **next** | **string**| An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. | [optional] | +| **previous** | **string**| An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. | [optional] | +| **sharing_key** | **string**| This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\ScoreDetails[]**](../Model/ScoreDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listCollections()` + +```php +listCollections($parent, $sort, $direction, $limit, $next, $previous): \Flat\APIClient\Model\Collection[] +``` + +List the collections + +Use this method to list the user's collections. If no sort option is provided, the collections are sorted by `creationDate` `desc`. By default (`parent=user`), this returns all user account collections with virtual collections on the first page. To fetch your app collection details, you can use `GET /v2/collections/app`. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\CollectionApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$parent = 'user'; // string | List the collections contained in this `parent` collection. When set to `user` (default), returns the user's own collections as well as collections shared with the user. Using `root` or `sharedWithMe` is **deprecated** and will be treated as `user`. +$sort = 'sort_example'; // string | Sort +$direction = 'direction_example'; // string | Sort direction +$limit = 25; // int | This is the maximum number of objects that may be returned +$next = 'next_example'; // string | An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$previous = 'previous_example'; // string | An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. + +try { + $result = $apiInstance->listCollections($parent, $sort, $direction, $limit, $next, $previous); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CollectionApi->listCollections: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **parent** | **string**| List the collections contained in this `parent` collection. When set to `user` (default), returns the user's own collections as well as collections shared with the user. Using `root` or `sharedWithMe` is **deprecated** and will be treated as `user`. | [optional] [default to 'user'] | +| **sort** | **string**| Sort | [optional] | +| **direction** | **string**| Sort direction | [optional] | +| **limit** | **int**| This is the maximum number of objects that may be returned | [optional] [default to 25] | +| **next** | **string**| An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. | [optional] | +| **previous** | **string**| An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\Collection[]**](../Model/Collection.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `untrashCollection()` + +```php +untrashCollection($collection): \Flat\APIClient\Model\FlatErrorResponse +``` + +Untrash a collection + +**DEPRECATED** This method will restore the collection by removing it from the `trash` and add it back to the `root` collection. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\CollectionApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$collection = 'collection_example'; // string | Unique identifier of the collection. + +try { + $result = $apiInstance->untrashCollection($collection); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CollectionApi->untrashCollection: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **collection** | **string**| Unique identifier of the collection. | | + +### Return type + +[**\Flat\APIClient\Model\FlatErrorResponse**](../Model/FlatErrorResponse.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/reference/Api/EduResourcesApi.md b/docs/reference/Api/EduResourcesApi.md new file mode 100644 index 0000000..9b6ed6b --- /dev/null +++ b/docs/reference/Api/EduResourcesApi.md @@ -0,0 +1,749 @@ +# Flat\APIClient\EduResourcesApi + +All URIs are relative to https://api.flat.io/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**copyEduResource()**](EduResourcesApi.md#copyEduResource) | **POST** /eduResources/{resource}/copy | Copy an education resource to a Resource Library | +| [**copyEduResourceToDemoClass()**](EduResourcesApi.md#copyEduResourceToDemoClass) | **POST** /eduResources/{resource}/copyToDemoClass | Copy an education assignment to a teacher demo class | +| [**createEduResource()**](EduResourcesApi.md#createEduResource) | **POST** /eduResources | Create a new education resource | +| [**createEduResourceLtiLink()**](EduResourcesApi.md#createEduResourceLtiLink) | **POST** /eduResources/{resource}/createLtiLink | Create an LTI link for an education resource | +| [**deleteEduResource()**](EduResourcesApi.md#deleteEduResource) | **DELETE** /eduResources/{resource} | Delete an education resource | +| [**getEduResource()**](EduResourcesApi.md#getEduResource) | **GET** /eduResources/{resource} | Get an education resource | +| [**listEduLibraries()**](EduResourcesApi.md#listEduLibraries) | **GET** /eduResources/libraries | List the education libraries | +| [**listEduResources()**](EduResourcesApi.md#listEduResources) | **GET** /eduResources | List education resources in a library or folder | +| [**moveEduResource()**](EduResourcesApi.md#moveEduResource) | **POST** /eduResources/{resource}/move | Move an education resource | +| [**updateEduResource()**](EduResourcesApi.md#updateEduResource) | **PUT** /eduResources/{resource} | Update an education resource metadata | +| [**updateEduResourceAssignment()**](EduResourcesApi.md#updateEduResourceAssignment) | **PUT** /eduResources/{resource}/assignment | Update an education resource assignment | +| [**useEduResourceInClass()**](EduResourcesApi.md#useEduResourceInClass) | **POST** /eduResources/{resource}/useInClass | Use an education resource in a class | + + +## `copyEduResource()` + +```php +copyEduResource($resource, $edu_resource_copy): \Flat\APIClient\Model\EduResource +``` + +Copy an education resource to a Resource Library + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\EduResourcesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$resource = 'resource_example'; // string | Unique identifier of the resource +$edu_resource_copy = new \Flat\APIClient\Model\EduResourceCopy(); // \Flat\APIClient\Model\EduResourceCopy + +try { + $result = $apiInstance->copyEduResource($resource, $edu_resource_copy); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EduResourcesApi->copyEduResource: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **resource** | **string**| Unique identifier of the resource | | +| **edu_resource_copy** | [**\Flat\APIClient\Model\EduResourceCopy**](../Model/EduResourceCopy.md)| | | + +### Return type + +[**\Flat\APIClient\Model\EduResource**](../Model/EduResource.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `copyEduResourceToDemoClass()` + +```php +copyEduResourceToDemoClass($resource): \Flat\APIClient\Model\ClassAssignment +``` + +Copy an education assignment to a teacher demo class + +Once a resource library can be published to a class (`Assignment.capabilities.canPublishInClass = true`), this endpoint can be used for the feature \"View as student\". It will ensure the teacher has a demo class, then copy the assignment to the demo class. You can then use `POST /classes/{class}/testStudent` to create a testing student account in the demo class. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\EduResourcesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$resource = 'resource_example'; // string | Unique identifier of the resource + +try { + $result = $apiInstance->copyEduResourceToDemoClass($resource); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EduResourcesApi->copyEduResourceToDemoClass: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **resource** | **string**| Unique identifier of the resource | | + +### Return type + +[**\Flat\APIClient\Model\ClassAssignment**](../Model/ClassAssignment.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createEduResource()` + +```php +createEduResource($edu_resource_creation): \Flat\APIClient\Model\EduResource +``` + +Create a new education resource + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\EduResourcesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$edu_resource_creation = new \Flat\APIClient\Model\EduResourceCreation(); // \Flat\APIClient\Model\EduResourceCreation + +try { + $result = $apiInstance->createEduResource($edu_resource_creation); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EduResourcesApi->createEduResource: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **edu_resource_creation** | [**\Flat\APIClient\Model\EduResourceCreation**](../Model/EduResourceCreation.md)| | | + +### Return type + +[**\Flat\APIClient\Model\EduResource**](../Model/EduResource.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createEduResourceLtiLink()` + +```php +createEduResourceLtiLink($resource): \Flat\APIClient\Model\EduResourceLtiLink +``` + +Create an LTI link for an education resource + +This endpoint will return an LTI link that can be used to launch Flat for Education. The link, in a context from a class, will ensure the assignment has been copied in the class. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\EduResourcesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$resource = 'resource_example'; // string | Unique identifier of the resource + +try { + $result = $apiInstance->createEduResourceLtiLink($resource); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EduResourcesApi->createEduResourceLtiLink: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **resource** | **string**| Unique identifier of the resource | | + +### Return type + +[**\Flat\APIClient\Model\EduResourceLtiLink**](../Model/EduResourceLtiLink.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteEduResource()` + +```php +deleteEduResource($resource) +``` + +Delete an education resource + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\EduResourcesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$resource = 'resource_example'; // string | Unique identifier of the resource + +try { + $apiInstance->deleteEduResource($resource); +} catch (Exception $e) { + echo 'Exception when calling EduResourcesApi->deleteEduResource: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **resource** | **string**| Unique identifier of the resource | | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getEduResource()` + +```php +getEduResource($resource): \Flat\APIClient\Model\EduResource +``` + +Get an education resource + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\EduResourcesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$resource = 'resource_example'; // string | Unique identifier of the resource + +try { + $result = $apiInstance->getEduResource($resource); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EduResourcesApi->getEduResource: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **resource** | **string**| Unique identifier of the resource | | + +### Return type + +[**\Flat\APIClient\Model\EduResource**](../Model/EduResource.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listEduLibraries()` + +```php +listEduLibraries(): \Flat\APIClient\Model\EduLibrary[] +``` + +List the education libraries + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\EduResourcesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->listEduLibraries(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EduResourcesApi->listEduLibraries: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Flat\APIClient\Model\EduLibrary[]**](../Model/EduLibrary.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listEduResources()` + +```php +listEduResources($parent, $without_subfolders_resources, $type, $subjects, $assignment_types, $grades, $sort, $direction, $limit, $next, $previous): \Flat\APIClient\Model\EduResource[] +``` + +List education resources in a library or folder + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\EduResourcesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$parent = 'root'; // string | List the resources contained in this `parent` library or folder. Accepts a folder identifier, or the identifier of one of the libraries returned by [`listEduLibraries`](#tag/EduResources/operation/listEduLibraries). Which libraries are available depends on the account, so use the `id` values that endpoint returns rather than hardcoding this list: * `root`: the user's own resources * `organization`: resources shared with the organization +$without_subfolders_resources = True; // bool | For the `parent` = `organization`, do not include resources from subfolders. By default in the Resource Library UI, we include resources from subfolders, but for example in a picker like LTI, we don't want to include them. +$type = 'type_example'; // string | Filter the returned resources by type +$subjects = array(new \Flat\APIClient\Model\\Flat\APIClient\Model\TeachingTheme()); // \Flat\APIClient\Model\TeachingTheme[] | Filter the returned resources by subjects +$assignment_types = array(new \Flat\APIClient\Model\\Flat\APIClient\Model\AssignmentType()); // \Flat\APIClient\Model\AssignmentType[] | Filter the returned resources by assignment types +$grades = array(new \Flat\APIClient\Model\\Flat\APIClient\Model\Grade()); // \Flat\APIClient\Model\Grade[] | Filter the returned resources by grades +$sort = 'creationDate'; // string | Sort +$direction = 'direction_example'; // string | Sort direction +$limit = 25; // int | This is the maximum number of resources that may be returned +$next = 'next_example'; // string | An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$previous = 'previous_example'; // string | An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. + +try { + $result = $apiInstance->listEduResources($parent, $without_subfolders_resources, $type, $subjects, $assignment_types, $grades, $sort, $direction, $limit, $next, $previous); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EduResourcesApi->listEduResources: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **parent** | **string**| List the resources contained in this `parent` library or folder. Accepts a folder identifier, or the identifier of one of the libraries returned by [`listEduLibraries`](#tag/EduResources/operation/listEduLibraries). Which libraries are available depends on the account, so use the `id` values that endpoint returns rather than hardcoding this list: * `root`: the user's own resources * `organization`: resources shared with the organization | [optional] [default to 'root'] | +| **without_subfolders_resources** | **bool**| For the `parent` = `organization`, do not include resources from subfolders. By default in the Resource Library UI, we include resources from subfolders, but for example in a picker like LTI, we don't want to include them. | [optional] | +| **type** | **string**| Filter the returned resources by type | [optional] | +| **subjects** | [**\Flat\APIClient\Model\TeachingTheme[]**](../Model/\Flat\APIClient\Model\TeachingTheme.md)| Filter the returned resources by subjects | [optional] | +| **assignment_types** | [**\Flat\APIClient\Model\AssignmentType[]**](../Model/\Flat\APIClient\Model\AssignmentType.md)| Filter the returned resources by assignment types | [optional] | +| **grades** | [**\Flat\APIClient\Model\Grade[]**](../Model/\Flat\APIClient\Model\Grade.md)| Filter the returned resources by grades | [optional] | +| **sort** | **string**| Sort | [optional] [default to 'creationDate'] | +| **direction** | **string**| Sort direction | [optional] | +| **limit** | **int**| This is the maximum number of resources that may be returned | [optional] [default to 25] | +| **next** | **string**| An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. | [optional] | +| **previous** | **string**| An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\EduResource[]**](../Model/EduResource.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `moveEduResource()` + +```php +moveEduResource($resource, $edu_resource_move): \Flat\APIClient\Model\EduResource +``` + +Move an education resource + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\EduResourcesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$resource = 'resource_example'; // string | Unique identifier of the resource +$edu_resource_move = new \Flat\APIClient\Model\EduResourceMove(); // \Flat\APIClient\Model\EduResourceMove + +try { + $result = $apiInstance->moveEduResource($resource, $edu_resource_move); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EduResourcesApi->moveEduResource: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **resource** | **string**| Unique identifier of the resource | | +| **edu_resource_move** | [**\Flat\APIClient\Model\EduResourceMove**](../Model/EduResourceMove.md)| | | + +### Return type + +[**\Flat\APIClient\Model\EduResource**](../Model/EduResource.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateEduResource()` + +```php +updateEduResource($resource, $edu_resource_update): \Flat\APIClient\Model\EduResource +``` + +Update an education resource metadata + +Update any resources metadata (e.g. title). Use this method to rename education resources folders or assignments. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\EduResourcesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$resource = 'resource_example'; // string | Unique identifier of the resource +$edu_resource_update = new \Flat\APIClient\Model\EduResourceUpdate(); // \Flat\APIClient\Model\EduResourceUpdate + +try { + $result = $apiInstance->updateEduResource($resource, $edu_resource_update); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EduResourcesApi->updateEduResource: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **resource** | **string**| Unique identifier of the resource | | +| **edu_resource_update** | [**\Flat\APIClient\Model\EduResourceUpdate**](../Model/EduResourceUpdate.md)| | | + +### Return type + +[**\Flat\APIClient\Model\EduResource**](../Model/EduResource.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateEduResourceAssignment()` + +```php +updateEduResourceAssignment($resource, $assignment_update): \Flat\APIClient\Model\Assignment +``` + +Update an education resource assignment + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\EduResourcesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$resource = 'resource_example'; // string | Unique identifier of the resource +$assignment_update = new \Flat\APIClient\Model\AssignmentUpdate(); // \Flat\APIClient\Model\AssignmentUpdate + +try { + $result = $apiInstance->updateEduResourceAssignment($resource, $assignment_update); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EduResourcesApi->updateEduResourceAssignment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **resource** | **string**| Unique identifier of the resource | | +| **assignment_update** | [**\Flat\APIClient\Model\AssignmentUpdate**](../Model/AssignmentUpdate.md)| | | + +### Return type + +[**\Flat\APIClient\Model\Assignment**](../Model/Assignment.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `useEduResourceInClass()` + +```php +useEduResourceInClass($resource, $edu_resource_use_in_class): \Flat\APIClient\Model\ClassAssignment +``` + +Use an education resource in a class + +This endpoint will copy a resource and the underlying resources. The assignment will be created as a draft that can be completed with other options before publishing (e.g. due date, publication date for scheduling, etc.). + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\EduResourcesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$resource = 'resource_example'; // string | Unique identifier of the resource +$edu_resource_use_in_class = new \Flat\APIClient\Model\EduResourceUseInClass(); // \Flat\APIClient\Model\EduResourceUseInClass + +try { + $result = $apiInstance->useEduResourceInClass($resource, $edu_resource_use_in_class); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EduResourcesApi->useEduResourceInClass: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **resource** | **string**| Unique identifier of the resource | | +| **edu_resource_use_in_class** | [**\Flat\APIClient\Model\EduResourceUseInClass**](../Model/EduResourceUseInClass.md)| | | + +### Return type + +[**\Flat\APIClient\Model\ClassAssignment**](../Model/ClassAssignment.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/reference/Api/GroupApi.md b/docs/reference/Api/GroupApi.md new file mode 100644 index 0000000..7001f4b --- /dev/null +++ b/docs/reference/Api/GroupApi.md @@ -0,0 +1,564 @@ +# Flat\APIClient\GroupApi + +All URIs are relative to https://api.flat.io/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**addGroupUser()**](GroupApi.md#addGroupUser) | **POST** /groups/{group}/users | Add a student to a group | +| [**createGroup()**](GroupApi.md#createGroup) | **POST** /groups | Create a new group | +| [**deleteGroup()**](GroupApi.md#deleteGroup) | **DELETE** /groups/{group} | Delete a group | +| [**getGroupDetails()**](GroupApi.md#getGroupDetails) | **GET** /groups/{group} | Get group information | +| [**getGroupScores()**](GroupApi.md#getGroupScores) | **GET** /groups/{group}/scores | List group's scores | +| [**listGroupUsers()**](GroupApi.md#listGroupUsers) | **GET** /groups/{group}/users | List group's users | +| [**listGroups()**](GroupApi.md#listGroups) | **GET** /groups | List groups | +| [**removeGroupUser()**](GroupApi.md#removeGroupUser) | **DELETE** /groups/{group}/users/{user} | Remove a student from a class group | +| [**renameGroup()**](GroupApi.md#renameGroup) | **PUT** /groups/{group} | Rename a group | + + +## `addGroupUser()` + +```php +addGroupUser($group, $add_group_user_request): \Flat\APIClient\Model\AddGroupUser200Response +``` + +Add a student to a group + +Add a student to the specified group (must be in the same class) + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\GroupApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$group = 'group_example'; // string | Unique identifier of a Flat group +$add_group_user_request = new \Flat\APIClient\Model\AddGroupUserRequest(); // \Flat\APIClient\Model\AddGroupUserRequest + +try { + $result = $apiInstance->addGroupUser($group, $add_group_user_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling GroupApi->addGroupUser: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **group** | **string**| Unique identifier of a Flat group | | +| **add_group_user_request** | [**\Flat\APIClient\Model\AddGroupUserRequest**](../Model/AddGroupUserRequest.md)| | | + +### Return type + +[**\Flat\APIClient\Model\AddGroupUser200Response**](../Model/AddGroupUser200Response.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createGroup()` + +```php +createGroup($group_creation): \Flat\APIClient\Model\GroupDetails +``` + +Create a new group + +Create a group of the given type, tied to a classroom, optionally with initial members. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\GroupApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$group_creation = new \Flat\APIClient\Model\GroupCreation(); // \Flat\APIClient\Model\GroupCreation + +try { + $result = $apiInstance->createGroup($group_creation); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling GroupApi->createGroup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **group_creation** | [**\Flat\APIClient\Model\GroupCreation**](../Model/GroupCreation.md)| | | + +### Return type + +[**\Flat\APIClient\Model\GroupDetails**](../Model/GroupDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteGroup()` + +```php +deleteGroup($group) +``` + +Delete a group + +Delete a group. Only available to teachers of the classroom. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\GroupApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$group = 'group_example'; // string | Unique identifier of a Flat group + +try { + $apiInstance->deleteGroup($group); +} catch (Exception $e) { + echo 'Exception when calling GroupApi->deleteGroup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **group** | **string**| Unique identifier of a Flat group | | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getGroupDetails()` + +```php +getGroupDetails($group): \Flat\APIClient\Model\GroupDetails +``` + +Get group information + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\GroupApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$group = 'group_example'; // string | Unique identifier of a Flat group + +try { + $result = $apiInstance->getGroupDetails($group); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling GroupApi->getGroupDetails: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **group** | **string**| Unique identifier of a Flat group | | + +### Return type + +[**\Flat\APIClient\Model\GroupDetails**](../Model/GroupDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getGroupScores()` + +```php +getGroupScores($group, $parent): \Flat\APIClient\Model\ScoreDetails[] +``` + +List group's scores + +Get the list of scores shared with a group. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\GroupApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$group = 'group_example'; // string | Unique identifier of a Flat group +$parent = 'parent_example'; // string | Filter the score forked from the score id `parent` + +try { + $result = $apiInstance->getGroupScores($group, $parent); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling GroupApi->getGroupScores: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **group** | **string**| Unique identifier of a Flat group | | +| **parent** | **string**| Filter the score forked from the score id `parent` | [optional] | + +### Return type + +[**\Flat\APIClient\Model\ScoreDetails[]**](../Model/ScoreDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listGroupUsers()` + +```php +listGroupUsers($group, $source): \Flat\APIClient\Model\UserPublic[] +``` + +List group's users + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\GroupApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$group = 'group_example'; // string | Unique identifier of a Flat group +$source = 'source_example'; // string | Filter the users by their source + +try { + $result = $apiInstance->listGroupUsers($group, $source); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling GroupApi->listGroupUsers: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **group** | **string**| Unique identifier of a Flat group | | +| **source** | **string**| Filter the users by their source | [optional] | + +### Return type + +[**\Flat\APIClient\Model\UserPublic[]**](../Model/UserPublic.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listGroups()` + +```php +listGroups($type, $classroom, $assignment): \Flat\APIClient\Model\GroupDetails[] +``` + +List groups + +List all groups of a given type, filtered by either a classroom or an assignment. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\GroupApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$type = 'type_example'; // string +$classroom = 'classroom_example'; // string | Classroom ID to filter by +$assignment = 'assignment_example'; // string | Assignment ID to filter by + +try { + $result = $apiInstance->listGroups($type, $classroom, $assignment); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling GroupApi->listGroups: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **type** | **string**| | | +| **classroom** | **string**| Classroom ID to filter by | [optional] | +| **assignment** | **string**| Assignment ID to filter by | [optional] | + +### Return type + +[**\Flat\APIClient\Model\GroupDetails[]**](../Model/GroupDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `removeGroupUser()` + +```php +removeGroupUser($group, $user) +``` + +Remove a student from a class group + +Remove a student from a class group + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\GroupApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$group = 'group_example'; // string | Unique identifier of a Flat group +$user = 'user_example'; // string | User ID + +try { + $apiInstance->removeGroupUser($group, $user); +} catch (Exception $e) { + echo 'Exception when calling GroupApi->removeGroupUser: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **group** | **string**| Unique identifier of a Flat group | | +| **user** | **string**| User ID | | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `renameGroup()` + +```php +renameGroup($group, $rename_group_request): \Flat\APIClient\Model\GroupDetails +``` + +Rename a group + +Rename a sub-group. Only available for class student groups. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\GroupApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$group = 'group_example'; // string | Unique identifier of a Flat group +$rename_group_request = new \Flat\APIClient\Model\RenameGroupRequest(); // \Flat\APIClient\Model\RenameGroupRequest + +try { + $result = $apiInstance->renameGroup($group, $rename_group_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling GroupApi->renameGroup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **group** | **string**| Unique identifier of a Flat group | | +| **rename_group_request** | [**\Flat\APIClient\Model\RenameGroupRequest**](../Model/RenameGroupRequest.md)| | | + +### Return type + +[**\Flat\APIClient\Model\GroupDetails**](../Model/GroupDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/reference/Api/OMRApi.md b/docs/reference/Api/OMRApi.md new file mode 100644 index 0000000..53a57b2 --- /dev/null +++ b/docs/reference/Api/OMRApi.md @@ -0,0 +1,783 @@ +# Flat\APIClient\OMRApi + +All URIs are relative to https://api.flat.io/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**addOmrJobFile()**](OMRApi.md#addOmrJobFile) | **POST** /omr/jobs/{job}/files | Add a file to an OMR job | +| [**cancelOmrJob()**](OMRApi.md#cancelOmrJob) | **POST** /omr/jobs/{job}/cancel | Cancel an OMR job | +| [**createOmrJob()**](OMRApi.md#createOmrJob) | **POST** /omr/jobs | Create an OMR job | +| [**deleteOmrJob()**](OMRApi.md#deleteOmrJob) | **DELETE** /omr/jobs/{job} | Delete an OMR job's data | +| [**getOmrCapabilities()**](OMRApi.md#getOmrCapabilities) | **GET** /omr/capabilities | OMR capabilities and limits | +| [**getOmrJob()**](OMRApi.md#getOmrJob) | **GET** /omr/jobs/{job} | Get an OMR job | +| [**getOmrJobExport()**](OMRApi.md#getOmrJobExport) | **GET** /omr/jobs/{job}/exports/{format} | Download the finalized result | +| [**getOmrJobFile()**](OMRApi.md#getOmrJobFile) | **GET** /omr/jobs/{job}/files/{index} | Get an input page image | +| [**listBillingCreditsHistory()**](OMRApi.md#listBillingCreditsHistory) | **GET** /billing/credits/history | List credit history | +| [**listOmrJobs()**](OMRApi.md#listOmrJobs) | **GET** /omr/jobs | List OMR jobs | +| [**startOmrJob()**](OMRApi.md#startOmrJob) | **POST** /omr/jobs/{job}/start | Start an OMR job | +| [**submitOmrJobStep()**](OMRApi.md#submitOmrJobStep) | **POST** /omr/jobs/{job}/steps/{step} | Submit an interactive step | + + +## `addOmrJobFile()` + +```php +addOmrJobFile($job, $omr_job_file_upload, $x_flat_locale): \Flat\APIClient\Model\OmrJobFileUploadResult +``` + +Add a file to an OMR job + +Add one image or PDF to a draft job. Call once per file; files keep their upload order. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OMRApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$job = 'job_example'; // string | Unique identifier of the OMR job +$omr_job_file_upload = new \Flat\APIClient\Model\OmrJobFileUpload(); // \Flat\APIClient\Model\OmrJobFileUpload +$x_flat_locale = fr; // string | Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. + +try { + $result = $apiInstance->addOmrJobFile($job, $omr_job_file_upload, $x_flat_locale); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OMRApi->addOmrJobFile: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **job** | **string**| Unique identifier of the OMR job | | +| **omr_job_file_upload** | [**\Flat\APIClient\Model\OmrJobFileUpload**](../Model/OmrJobFileUpload.md)| | | +| **x_flat_locale** | **string**| Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\OmrJobFileUploadResult**](../Model/OmrJobFileUploadResult.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `cancelOmrJob()` + +```php +cancelOmrJob($job, $x_flat_locale): \Flat\APIClient\Model\OmrJob +``` + +Cancel an OMR job + +Cancel a draft or in-flight job. Any charged credits are reversed. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OMRApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$job = 'job_example'; // string | Unique identifier of the OMR job +$x_flat_locale = fr; // string | Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. + +try { + $result = $apiInstance->cancelOmrJob($job, $x_flat_locale); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OMRApi->cancelOmrJob: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **job** | **string**| Unique identifier of the OMR job | | +| **x_flat_locale** | **string**| Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\OmrJob**](../Model/OmrJob.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createOmrJob()` + +```php +createOmrJob($omr_job_creation, $x_flat_locale): \Flat\APIClient\Model\OmrJob +``` + +Create an OMR job + +Create an Optical Music Recognition job. There are two ways to call this endpoint: * **Draft:** send the parameters without `files` to create an empty job, then add files with `addOmrJobFile`, then run it with `startOmrJob`. Best for multiple images or incremental mobile capture. * **One-shot:** include `files` and `autoStart: true` to import in a single request. Best for a single PDF or a third-party integration. Declare the interactive steps your client supports in `interactiveSteps`: the pipeline runs fully automatically and only pauses at the steps you list. Steps you do not list, including ones added in the future, are auto-resolved with server defaults, so older clients never break. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OMRApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$omr_job_creation = new \Flat\APIClient\Model\OmrJobCreation(); // \Flat\APIClient\Model\OmrJobCreation +$x_flat_locale = fr; // string | Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. + +try { + $result = $apiInstance->createOmrJob($omr_job_creation, $x_flat_locale); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OMRApi->createOmrJob: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **omr_job_creation** | [**\Flat\APIClient\Model\OmrJobCreation**](../Model/OmrJobCreation.md)| | | +| **x_flat_locale** | **string**| Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\OmrJob**](../Model/OmrJob.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteOmrJob()` + +```php +deleteOmrJob($job, $x_flat_locale): \Flat\APIClient\Model\OmrJob +``` + +Delete an OMR job's data + +Erase a job's uploaded files and recognition results now, instead of waiting for its retention deadline. Use this to serve a deletion request from your own end user. Reaches the same end state as the scheduled cleanup: the files are gone, the job keeps the `status` it finished with, stays listable, and reports `retention.expiredDate`. Downloads then fail with `OMR_JOB_EXPIRED`. Only available for jobs whose `output` is `musicxml`. Library imports are not covered by the retention policy and are rejected with `OMR_JOB_NOT_EXPIRABLE`; delete the resulting score instead. The job must have finished (`done`, `error` or `canceled`). A draft or in-flight job is rejected with `OMR_JOB_IN_PROGRESS`: cancel it first, then delete. Deleting never cancels on your behalf, because cancellation reverses charged credits and that must not happen as a side effect of erasing data. Calling this again on an already-erased job succeeds and changes nothing. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OMRApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$job = 'job_example'; // string | Unique identifier of the OMR job +$x_flat_locale = fr; // string | Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. + +try { + $result = $apiInstance->deleteOmrJob($job, $x_flat_locale); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OMRApi->deleteOmrJob: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **job** | **string**| Unique identifier of the OMR job | | +| **x_flat_locale** | **string**| Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\OmrJob**](../Model/OmrJob.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getOmrCapabilities()` + +```php +getOmrCapabilities($x_flat_locale): \Flat\APIClient\Model\OmrCapabilities +``` + +OMR capabilities and limits + +Advertises the supported steps, export formats, limits, cost-per-page, remaining credits and locales, so clients can feature-detect instead of hardcoding behavior. Authentication is optional: called without an account, the limits are those of the free plan and `remainingCredits` is omitted. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OMRApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$x_flat_locale = fr; // string | Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. + +try { + $result = $apiInstance->getOmrCapabilities($x_flat_locale); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OMRApi->getOmrCapabilities: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **x_flat_locale** | **string**| Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\OmrCapabilities**](../Model/OmrCapabilities.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getOmrJob()` + +```php +getOmrJob($job, $wait, $x_flat_locale): \Flat\APIClient\Model\OmrJob +``` + +Get an OMR job + +Get the current state of an OMR job. This is the primary polling endpoint. Pass `wait` to long-poll until the state changes. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OMRApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$job = 'job_example'; // string | Unique identifier of the OMR job +$wait = 56; // int | Long-poll up to this many seconds for a state change before returning. +$x_flat_locale = fr; // string | Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. + +try { + $result = $apiInstance->getOmrJob($job, $wait, $x_flat_locale); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OMRApi->getOmrJob: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **job** | **string**| Unique identifier of the OMR job | | +| **wait** | **int**| Long-poll up to this many seconds for a state change before returning. | [optional] | +| **x_flat_locale** | **string**| Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\OmrJob**](../Model/OmrJob.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getOmrJobExport()` + +```php +getOmrJobExport($job, $format, $x_flat_locale): \SplFileObject +``` + +Download the finalized result + +Stream the finalized result in the requested format. Available once the job is `done`. For `output: musicxml` jobs this is the primary way to retrieve the result; no library score is created. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OMRApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$job = 'job_example'; // string | Unique identifier of the OMR job +$format = 'format_example'; // string | Export format. New formats may be added over time; request what your client supports. * `musicxml`: Uncompressed MusicXML (plain text `.xml`, `application/vnd.recordare.musicxml+xml`). * `mxl`: Compressed MusicXML (zip archive `.mxl`, `application/vnd.recordare.musicxml`), the same notation as `musicxml` but smaller to download. * `midi`: Standard MIDI file (`.mid`, `audio/midi`). * `thumbnail.png`: PNG preview of the first page (`image/png`). +$x_flat_locale = fr; // string | Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. + +try { + $result = $apiInstance->getOmrJobExport($job, $format, $x_flat_locale); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OMRApi->getOmrJobExport: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **job** | **string**| Unique identifier of the OMR job | | +| **format** | **string**| Export format. New formats may be added over time; request what your client supports. * `musicxml`: Uncompressed MusicXML (plain text `.xml`, `application/vnd.recordare.musicxml+xml`). * `mxl`: Compressed MusicXML (zip archive `.mxl`, `application/vnd.recordare.musicxml`), the same notation as `musicxml` but smaller to download. * `midi`: Standard MIDI file (`.mid`, `audio/midi`). * `thumbnail.png`: PNG preview of the first page (`image/png`). | | +| **x_flat_locale** | **string**| Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. | [optional] | + +### Return type + +**\SplFileObject** + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/octet-stream`, `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getOmrJobFile()` + +```php +getOmrJobFile($job, $index, $x_flat_locale): \SplFileObject +``` + +Get an input page image + +Fetch one of the job's input files (a page image or PDF) by index, for the review UI. Once data retention has erased the job, this returns 409 `OMR_JOB_EXPIRED`. Read `retention.expiredDate` on the job to tell that case apart before requesting a file. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OMRApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$job = 'job_example'; // string | Unique identifier of the OMR job +$index = 56; // int | 0-based index of the input file (page) to fetch. +$x_flat_locale = fr; // string | Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. + +try { + $result = $apiInstance->getOmrJobFile($job, $index, $x_flat_locale); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OMRApi->getOmrJobFile: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **job** | **string**| Unique identifier of the OMR job | | +| **index** | **int**| 0-based index of the input file (page) to fetch. | | +| **x_flat_locale** | **string**| Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. | [optional] | + +### Return type + +**\SplFileObject** + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `image/jpeg`, `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listBillingCreditsHistory()` + +```php +listBillingCreditsHistory($limit, $next, $previous): \Flat\APIClient\Model\CreditTransaction[] +``` + +List credit history + +The credit ledger of the authenticated account, sorted by creation date descending (most recent entry first). Every entry that moved the balance is listed: the deductions taken when an import runs, and the top-ups added by a credit pack. Reversing a deduction does not add an entry, it flips the original one's `state` to `canceled`. Canceled entries stay in the list, so an import that was charged and then failed still shows its deduction rather than disappearing. Read `state` to tell the two apart, and sum only `active` entries. A refund can additionally add a positive entry when cancelling alone could not restore the full cost, for instance because the plan's allowance has since reset. The current balance is not computed from this list: read it from `getOmrCapabilities`. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OMRApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$limit = 50; // int | This is the maximum number of objects that may be returned +$next = 'next_example'; // string | An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$previous = 'previous_example'; // string | An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. + +try { + $result = $apiInstance->listBillingCreditsHistory($limit, $next, $previous); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OMRApi->listBillingCreditsHistory: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| This is the maximum number of objects that may be returned | [optional] [default to 50] | +| **next** | **string**| An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. | [optional] | +| **previous** | **string**| An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\CreditTransaction[]**](../Model/CreditTransaction.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listOmrJobs()` + +```php +listOmrJobs($status, $expired, $limit, $next, $previous, $x_flat_locale): \Flat\APIClient\Model\OmrJob[] +``` + +List OMR jobs + +List the caller's OMR jobs, for resuming work or cleaning up abandoned drafts. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OMRApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$status = new \Flat\APIClient\Model\\Flat\APIClient\Model\OmrJobStatus(); // \Flat\APIClient\Model\OmrJobStatus | Filter jobs by status +$expired = True; // bool | Filter by data-retention state, independently of `status`. * `true`: only jobs whose files have been erased. * `false`: only jobs that still hold their files. Omit to get both. A job keeps the `status` it finished with after erasure, so this is the only way to tell the two apart. +$limit = 50; // int | This is the maximum number of objects that may be returned +$next = 'next_example'; // string | An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$previous = 'previous_example'; // string | An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$x_flat_locale = fr; // string | Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. + +try { + $result = $apiInstance->listOmrJobs($status, $expired, $limit, $next, $previous, $x_flat_locale); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OMRApi->listOmrJobs: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **status** | [**\Flat\APIClient\Model\OmrJobStatus**](../Model/.md)| Filter jobs by status | [optional] | +| **expired** | **bool**| Filter by data-retention state, independently of `status`. * `true`: only jobs whose files have been erased. * `false`: only jobs that still hold their files. Omit to get both. A job keeps the `status` it finished with after erasure, so this is the only way to tell the two apart. | [optional] | +| **limit** | **int**| This is the maximum number of objects that may be returned | [optional] [default to 50] | +| **next** | **string**| An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. | [optional] | +| **previous** | **string**| An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. | [optional] | +| **x_flat_locale** | **string**| Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\OmrJob[]**](../Model/OmrJob.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `startOmrJob()` + +```php +startOmrJob($job, $x_flat_locale): \Flat\APIClient\Model\OmrJob +``` + +Start an OMR job + +Validate the attached files, run the permission, quota and credit checks, then queue the job for processing. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OMRApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$job = 'job_example'; // string | Unique identifier of the OMR job +$x_flat_locale = fr; // string | Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. + +try { + $result = $apiInstance->startOmrJob($job, $x_flat_locale); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OMRApi->startOmrJob: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **job** | **string**| Unique identifier of the OMR job | | +| **x_flat_locale** | **string**| Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\OmrJob**](../Model/OmrJob.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `submitOmrJobStep()` + +```php +submitOmrJobStep($job, $step, $body, $x_flat_locale): \Flat\APIClient\Model\OmrJob +``` + +Submit an interactive step + +Resolve the step the job is currently awaiting and resume the pipeline. The request body shape depends on `step` (a `oneOf` discriminated by the step name). + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OMRApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$job = 'job_example'; // string | Unique identifier of the OMR job +$step = new \Flat\APIClient\Model\\Flat\APIClient\Model\OmrStepName(); // \Flat\APIClient\Model\OmrStepName | The pending step being submitted +$body = new \Flat\APIClient\Model\OmrDetailsSubmission(); // \Flat\APIClient\Model\OmrDetailsSubmission +$x_flat_locale = fr; // string | Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. + +try { + $result = $apiInstance->submitOmrJobStep($job, $step, $body, $x_flat_locale); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OMRApi->submitOmrJobStep: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **job** | **string**| Unique identifier of the OMR job | | +| **step** | [**\Flat\APIClient\Model\OmrStepName**](../Model/.md)| The pending step being submitted | | +| **body** | **\Flat\APIClient\Model\OmrDetailsSubmission**| | | +| **x_flat_locale** | **string**| Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\OmrJob**](../Model/OmrJob.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/reference/Api/OrganizationApi.md b/docs/reference/Api/OrganizationApi.md new file mode 100644 index 0000000..988b9dd --- /dev/null +++ b/docs/reference/Api/OrganizationApi.md @@ -0,0 +1,1058 @@ +# Flat\APIClient\OrganizationApi + +All URIs are relative to https://api.flat.io/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**countOrgaUsers()**](OrganizationApi.md#countOrgaUsers) | **GET** /organizations/users/count | Count the organization users using the provided filters | +| [**createLtiConfiguration()**](OrganizationApi.md#createLtiConfiguration) | **POST** /organizations/lti/configurations | Create a new LTI configuration (1.1 or 1.3) | +| [**createLtiCredentials()**](OrganizationApi.md#createLtiCredentials) | **POST** /organizations/lti/credentials | Create a new couple of LTI 1.x credentials | +| [**createOrganizationInvitation()**](OrganizationApi.md#createOrganizationInvitation) | **POST** /organizations/invitations | Create a new invitation to join the organization | +| [**createOrganizationUser()**](OrganizationApi.md#createOrganizationUser) | **POST** /organizations/users | Create a new user account | +| [**createOrganizationUserAccessToken()**](OrganizationApi.md#createOrganizationUserAccessToken) | **POST** /organizations/users/{user}/accessToken | Create a delegated API access token for an organization user | +| [**createOrganizationUserSigninLink()**](OrganizationApi.md#createOrganizationUserSigninLink) | **POST** /organizations/users/{user}/signinLink | Create a sign in link for an organization user | +| [**deleteLtiConfiguration()**](OrganizationApi.md#deleteLtiConfiguration) | **DELETE** /organizations/lti/configurations/{configuration} | Delete an LTI configuration | +| [**listLtiConfigurations()**](OrganizationApi.md#listLtiConfigurations) | **GET** /organizations/lti/configurations | List LTI configurations (1.1 and 1.3) | +| [**listLtiCredentials()**](OrganizationApi.md#listLtiCredentials) | **GET** /organizations/lti/credentials | List LTI 1.x credentials | +| [**listOrganizationInvitations()**](OrganizationApi.md#listOrganizationInvitations) | **GET** /organizations/invitations | List the organization invitations | +| [**listOrganizationUsers()**](OrganizationApi.md#listOrganizationUsers) | **GET** /organizations/users | List the organization users | +| [**removeOrganizationInvitation()**](OrganizationApi.md#removeOrganizationInvitation) | **DELETE** /organizations/invitations/{invitation} | Remove an organization invitation | +| [**removeOrganizationUser()**](OrganizationApi.md#removeOrganizationUser) | **DELETE** /organizations/users/{user} | Remove an account from Flat | +| [**revokeLtiCredentials()**](OrganizationApi.md#revokeLtiCredentials) | **DELETE** /organizations/lti/credentials/{credentials} | Revoke LTI 1.x credentials | +| [**updateLtiConfiguration()**](OrganizationApi.md#updateLtiConfiguration) | **PUT** /organizations/lti/configurations/{configuration} | Update an existing LTI configuration (edit 1.3; 1.1 not editable) | +| [**updateOrganizationUser()**](OrganizationApi.md#updateOrganizationUser) | **PUT** /organizations/users/{user} | Update account information | + + +## `countOrgaUsers()` + +```php +countOrgaUsers($role, $q, $group, $no_active_license, $test_accounts): int +``` + +Count the organization users using the provided filters + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OrganizationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$role = array('role_example'); // string[] | Filter users by role +$q = 'q_example'; // string | The query to search +$group = array('group_example'); // string[] | Filter users by group +$no_active_license = True; // bool | Filter users who don't have an active license +$test_accounts = 'test_accounts_example'; // string | Filter users based on test account status. Test accounts are student accounts created for testing purposes by teachers. * `exclude`: Hide test accounts from results. * `only`: Show only test accounts. When omitted, all users are returned. + +try { + $result = $apiInstance->countOrgaUsers($role, $q, $group, $no_active_license, $test_accounts); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrganizationApi->countOrgaUsers: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **role** | [**string[]**](../Model/string.md)| Filter users by role | [optional] | +| **q** | **string**| The query to search | [optional] | +| **group** | [**string[]**](../Model/string.md)| Filter users by group | [optional] | +| **no_active_license** | **bool**| Filter users who don't have an active license | [optional] | +| **test_accounts** | **string**| Filter users based on test account status. Test accounts are student accounts created for testing purposes by teachers. * `exclude`: Hide test accounts from results. * `only`: Show only test accounts. When omitted, all users are returned. | [optional] | + +### Return type + +**int** + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createLtiConfiguration()` + +```php +createLtiConfiguration($lti_configuration_create): \Flat\APIClient\Model\LtiConfiguration +``` + +Create a new LTI configuration (1.1 or 1.3) + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OrganizationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$lti_configuration_create = new \Flat\APIClient\Model\LtiConfigurationCreate1p1(); // \Flat\APIClient\Model\LtiConfigurationCreate + +try { + $result = $apiInstance->createLtiConfiguration($lti_configuration_create); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrganizationApi->createLtiConfiguration: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **lti_configuration_create** | [**\Flat\APIClient\Model\LtiConfigurationCreate**](../Model/LtiConfigurationCreate.md)| | | + +### Return type + +[**\Flat\APIClient\Model\LtiConfiguration**](../Model/LtiConfiguration.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createLtiCredentials()` + +```php +createLtiCredentials($body): \Flat\APIClient\Model\LtiCredentials +``` + +Create a new couple of LTI 1.x credentials + +DEPRECATED. Use the unified endpoints under `/organizations/lti/configurations`. Note: Teachers may be restricted by the organization privacy setting `lti1p1AllowTeachersCredentials`. Flat for Education is a Certified LTI Provider. You can use these API methods to automate the creation of LTI credentials. You can read more about our LTI implementation, supported components and LTI Endpoints in our [Developer Documentation](https://flat.io/developers/docs/lti/). + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OrganizationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$body = new \Flat\APIClient\Model\LtiCredentialsCreation(); // \Flat\APIClient\Model\LtiCredentialsCreation + +try { + $result = $apiInstance->createLtiCredentials($body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrganizationApi->createLtiCredentials: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **body** | [**\Flat\APIClient\Model\LtiCredentialsCreation**](../Model/LtiCredentialsCreation.md)| | | + +### Return type + +[**\Flat\APIClient\Model\LtiCredentials**](../Model/LtiCredentials.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createOrganizationInvitation()` + +```php +createOrganizationInvitation($body): \Flat\APIClient\Model\OrganizationInvitation +``` + +Create a new invitation to join the organization + +This method creates and sends invitation for teachers and admins. Invitations can only be used by new Flat users or users who are not part of the organization yet. If the email of the user is already associated to a user of your organization, the API will simply update the role of the existing user and won't send an invitation. In this case, the property `usedBy` will be directly filled with the uniquer identifier of the corresponding user. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OrganizationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$body = new \Flat\APIClient\Model\OrganizationInvitationCreation(); // \Flat\APIClient\Model\OrganizationInvitationCreation + +try { + $result = $apiInstance->createOrganizationInvitation($body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrganizationApi->createOrganizationInvitation: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **body** | [**\Flat\APIClient\Model\OrganizationInvitationCreation**](../Model/OrganizationInvitationCreation.md)| | | + +### Return type + +[**\Flat\APIClient\Model\OrganizationInvitation**](../Model/OrganizationInvitation.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createOrganizationUser()` + +```php +createOrganizationUser($body): \Flat\APIClient\Model\UserDetailsAdmin +``` + +Create a new user account + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OrganizationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$body = new \Flat\APIClient\Model\UserCreation(); // \Flat\APIClient\Model\UserCreation + +try { + $result = $apiInstance->createOrganizationUser($body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrganizationApi->createOrganizationUser: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **body** | [**\Flat\APIClient\Model\UserCreation**](../Model/UserCreation.md)| | | + +### Return type + +[**\Flat\APIClient\Model\UserDetailsAdmin**](../Model/UserDetailsAdmin.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createOrganizationUserAccessToken()` + +```php +createOrganizationUserAccessToken($user, $organization_user_access_token_creation): \Flat\APIClient\Model\ApiAccessToken +``` + +Create a delegated API access token for an organization user + +This operation will create an API access token for a chosen organization user. This token will be valid for a limited time and can be used to access the API as the organization user. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OrganizationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$user = 'user_example'; // string | Unique identifier of the Flat account +$organization_user_access_token_creation = new \Flat\APIClient\Model\OrganizationUserAccessTokenCreation(); // \Flat\APIClient\Model\OrganizationUserAccessTokenCreation + +try { + $result = $apiInstance->createOrganizationUserAccessToken($user, $organization_user_access_token_creation); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrganizationApi->createOrganizationUserAccessToken: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **user** | **string**| Unique identifier of the Flat account | | +| **organization_user_access_token_creation** | [**\Flat\APIClient\Model\OrganizationUserAccessTokenCreation**](../Model/OrganizationUserAccessTokenCreation.md)| | | + +### Return type + +[**\Flat\APIClient\Model\ApiAccessToken**](../Model/ApiAccessToken.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createOrganizationUserSigninLink()` + +```php +createOrganizationUserSigninLink($user, $user_signin_link_creation): \Flat\APIClient\Model\UserSigninLink +``` + +Create a sign in link for an organization user + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OrganizationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$user = 'user_example'; // string | Unique identifier of the Flat account +$user_signin_link_creation = new \Flat\APIClient\Model\UserSigninLinkCreation(); // \Flat\APIClient\Model\UserSigninLinkCreation + +try { + $result = $apiInstance->createOrganizationUserSigninLink($user, $user_signin_link_creation); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrganizationApi->createOrganizationUserSigninLink: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **user** | **string**| Unique identifier of the Flat account | | +| **user_signin_link_creation** | [**\Flat\APIClient\Model\UserSigninLinkCreation**](../Model/UserSigninLinkCreation.md)| | | + +### Return type + +[**\Flat\APIClient\Model\UserSigninLink**](../Model/UserSigninLink.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteLtiConfiguration()` + +```php +deleteLtiConfiguration($configuration) +``` + +Delete an LTI configuration + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OrganizationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$configuration = 'configuration_example'; // string | Configuration unique identifier + +try { + $apiInstance->deleteLtiConfiguration($configuration); +} catch (Exception $e) { + echo 'Exception when calling OrganizationApi->deleteLtiConfiguration: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **configuration** | **string**| Configuration unique identifier | | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listLtiConfigurations()` + +```php +listLtiConfigurations(): \Flat\APIClient\Model\LtiConfiguration[] +``` + +List LTI configurations (1.1 and 1.3) + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OrganizationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->listLtiConfigurations(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrganizationApi->listLtiConfigurations: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Flat\APIClient\Model\LtiConfiguration[]**](../Model/LtiConfiguration.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listLtiCredentials()` + +```php +listLtiCredentials(): \Flat\APIClient\Model\LtiCredentials[] +``` + +List LTI 1.x credentials + +DEPRECATED. Use the unified endpoints under `/organizations/lti/configurations`. Note: Teachers may be restricted by the organization privacy setting `lti1p1AllowTeachersCredentials`. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OrganizationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->listLtiCredentials(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrganizationApi->listLtiCredentials: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Flat\APIClient\Model\LtiCredentials[]**](../Model/LtiCredentials.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listOrganizationInvitations()` + +```php +listOrganizationInvitations($role, $limit, $next, $previous): \Flat\APIClient\Model\OrganizationInvitation[] +``` + +List the organization invitations + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OrganizationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$role = 'role_example'; // string | Filter users by role +$limit = 50; // int | This is the maximum number of objects that may be returned +$next = 'next_example'; // string | An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$previous = 'previous_example'; // string | An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. + +try { + $result = $apiInstance->listOrganizationInvitations($role, $limit, $next, $previous); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrganizationApi->listOrganizationInvitations: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **role** | **string**| Filter users by role | [optional] | +| **limit** | **int**| This is the maximum number of objects that may be returned | [optional] [default to 50] | +| **next** | **string**| An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. | [optional] | +| **previous** | **string**| An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\OrganizationInvitation[]**](../Model/OrganizationInvitation.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listOrganizationUsers()` + +```php +listOrganizationUsers($sort, $direction, $next, $previous, $role, $q, $group, $no_active_license, $test_accounts, $license_expiration_date, $only_ids, $limit): \Flat\APIClient\Model\UserDetailsAdmin[] +``` + +List the organization users + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OrganizationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$sort = 'sort_example'; // string | The order to sort the user list. * `creationDate`: Order by account creation. * `firstname`, `lastname`, `username`: Order by the user identity. * `lastActivityDate`: Order by the last recorded activity. * `licenseExpirationDate`: Order by the expiration of the active license. +$direction = 'direction_example'; // string | Sort direction +$next = 'next_example'; // string | An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$previous = 'previous_example'; // string | An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$role = array('role_example'); // string[] | Filter users by role +$q = 'q_example'; // string | The query to search +$group = array('group_example'); // string[] | Filter users by group +$no_active_license = True; // bool | Filter users who don't have an active license +$test_accounts = 'test_accounts_example'; // string | Filter users based on test account status. Test accounts are student accounts created for testing purposes by teachers. * `exclude`: Hide test accounts from results. * `only`: Show only test accounts. When omitted, all users are returned. +$license_expiration_date = array('license_expiration_date_example'); // string[] | Filter users by license expiration date or `active` / `notActive` +$only_ids = True; // bool | Return only user ids +$limit = 25; // int | This is the maximum number of objects that may be returned + +try { + $result = $apiInstance->listOrganizationUsers($sort, $direction, $next, $previous, $role, $q, $group, $no_active_license, $test_accounts, $license_expiration_date, $only_ids, $limit); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrganizationApi->listOrganizationUsers: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **sort** | **string**| The order to sort the user list. * `creationDate`: Order by account creation. * `firstname`, `lastname`, `username`: Order by the user identity. * `lastActivityDate`: Order by the last recorded activity. * `licenseExpirationDate`: Order by the expiration of the active license. | [optional] | +| **direction** | **string**| Sort direction | [optional] | +| **next** | **string**| An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. | [optional] | +| **previous** | **string**| An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. | [optional] | +| **role** | [**string[]**](../Model/string.md)| Filter users by role | [optional] | +| **q** | **string**| The query to search | [optional] | +| **group** | [**string[]**](../Model/string.md)| Filter users by group | [optional] | +| **no_active_license** | **bool**| Filter users who don't have an active license | [optional] | +| **test_accounts** | **string**| Filter users based on test account status. Test accounts are student accounts created for testing purposes by teachers. * `exclude`: Hide test accounts from results. * `only`: Show only test accounts. When omitted, all users are returned. | [optional] | +| **license_expiration_date** | [**string[]**](../Model/string.md)| Filter users by license expiration date or `active` / `notActive` | [optional] | +| **only_ids** | **bool**| Return only user ids | [optional] | +| **limit** | **int**| This is the maximum number of objects that may be returned | [optional] [default to 25] | + +### Return type + +[**\Flat\APIClient\Model\UserDetailsAdmin[]**](../Model/UserDetailsAdmin.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `removeOrganizationInvitation()` + +```php +removeOrganizationInvitation($invitation) +``` + +Remove an organization invitation + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OrganizationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$invitation = 'invitation_example'; // string | Unique identifier of the invitation + +try { + $apiInstance->removeOrganizationInvitation($invitation); +} catch (Exception $e) { + echo 'Exception when calling OrganizationApi->removeOrganizationInvitation: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **invitation** | **string**| Unique identifier of the invitation | | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `removeOrganizationUser()` + +```php +removeOrganizationUser($user, $convert_to_individual) +``` + +Remove an account from Flat + +This operation removes an account from Flat and its data, including: * The music scores created by this user (documents, history, comments, collaboration information) * Education related data (assignments and classroom information) + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OrganizationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$user = 'user_example'; // string | Unique identifier of the Flat account +$convert_to_individual = True; // bool | If `true`, the account will be only removed from the organization and converted into an individual account on our public website, https://flat.io. This operation will remove the education-related data from the account. Before realizing this operation, you need to be sure that the user is at least 13 years old and that this one has read and agreed to the Individual Terms of Services of Flat available on https://flat.io/legal. + +try { + $apiInstance->removeOrganizationUser($user, $convert_to_individual); +} catch (Exception $e) { + echo 'Exception when calling OrganizationApi->removeOrganizationUser: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **user** | **string**| Unique identifier of the Flat account | | +| **convert_to_individual** | **bool**| If `true`, the account will be only removed from the organization and converted into an individual account on our public website, https://flat.io. This operation will remove the education-related data from the account. Before realizing this operation, you need to be sure that the user is at least 13 years old and that this one has read and agreed to the Individual Terms of Services of Flat available on https://flat.io/legal. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `revokeLtiCredentials()` + +```php +revokeLtiCredentials($credentials) +``` + +Revoke LTI 1.x credentials + +DEPRECATED. Use the unified endpoints under `/organizations/lti/configurations`. Note: Teachers may be restricted by the organization privacy setting `lti1p1AllowTeachersCredentials`. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OrganizationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$credentials = 'credentials_example'; // string | Credentials unique identifier + +try { + $apiInstance->revokeLtiCredentials($credentials); +} catch (Exception $e) { + echo 'Exception when calling OrganizationApi->revokeLtiCredentials: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **credentials** | **string**| Credentials unique identifier | | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateLtiConfiguration()` + +```php +updateLtiConfiguration($configuration, $lti_configuration_update): \Flat\APIClient\Model\LtiConfiguration +``` + +Update an existing LTI configuration (edit 1.3; 1.1 not editable) + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OrganizationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$configuration = 'configuration_example'; // string | Configuration unique identifier +$lti_configuration_update = new \Flat\APIClient\Model\LtiConfigurationUpdate(); // \Flat\APIClient\Model\LtiConfigurationUpdate + +try { + $result = $apiInstance->updateLtiConfiguration($configuration, $lti_configuration_update); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrganizationApi->updateLtiConfiguration: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **configuration** | **string**| Configuration unique identifier | | +| **lti_configuration_update** | [**\Flat\APIClient\Model\LtiConfigurationUpdate**](../Model/LtiConfigurationUpdate.md)| | | + +### Return type + +[**\Flat\APIClient\Model\LtiConfiguration**](../Model/LtiConfiguration.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateOrganizationUser()` + +```php +updateOrganizationUser($user, $body): \Flat\APIClient\Model\UserDetailsAdmin +``` + +Update account information + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\OrganizationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$user = 'user_example'; // string | Unique identifier of the Flat account +$body = new \Flat\APIClient\Model\UserAdminUpdate(); // \Flat\APIClient\Model\UserAdminUpdate + +try { + $result = $apiInstance->updateOrganizationUser($user, $body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrganizationApi->updateOrganizationUser: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **user** | **string**| Unique identifier of the Flat account | | +| **body** | [**\Flat\APIClient\Model\UserAdminUpdate**](../Model/UserAdminUpdate.md)| | | + +### Return type + +[**\Flat\APIClient\Model\UserDetailsAdmin**](../Model/UserDetailsAdmin.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/reference/Api/ScoreApi.md b/docs/reference/Api/ScoreApi.md new file mode 100644 index 0000000..e8ca3a9 --- /dev/null +++ b/docs/reference/Api/ScoreApi.md @@ -0,0 +1,1936 @@ +# Flat\APIClient\ScoreApi + +All URIs are relative to https://api.flat.io/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**addScoreCollaborator()**](ScoreApi.md#addScoreCollaborator) | **POST** /scores/{score}/collaborators | Add a new collaborator | +| [**addScoreTrack()**](ScoreApi.md#addScoreTrack) | **POST** /scores/{score}/tracks | Add a new video or audio track to the score | +| [**createExportTask()**](ScoreApi.md#createExportTask) | **POST** /scores/{score}/revisions/{revision}/{format}/task | Create a new score export task | +| [**createScore()**](ScoreApi.md#createScore) | **POST** /scores | Create a new score | +| [**createScoreRevision()**](ScoreApi.md#createScoreRevision) | **POST** /scores/{score}/revisions | Create a new revision | +| [**deleteScore()**](ScoreApi.md#deleteScore) | **DELETE** /scores/{score} | Delete a score | +| [**deleteScoreComment()**](ScoreApi.md#deleteScoreComment) | **DELETE** /scores/{score}/comments/{comment} | Delete a comment | +| [**deleteScoreTrack()**](ScoreApi.md#deleteScoreTrack) | **DELETE** /scores/{score}/tracks/{track} | Remove an audio or video track linked to the score | +| [**editScore()**](ScoreApi.md#editScore) | **PUT** /scores/{score} | Edit a score's metadata | +| [**forkScore()**](ScoreApi.md#forkScore) | **POST** /scores/{score}/fork | Fork a score | +| [**getGroupScores()**](ScoreApi.md#getGroupScores) | **GET** /groups/{group}/scores | List group's scores | +| [**getScore()**](ScoreApi.md#getScore) | **GET** /scores/{score} | Get a score's metadata | +| [**getScoreCollaborator()**](ScoreApi.md#getScoreCollaborator) | **GET** /scores/{score}/collaborators/{collaborator} | Get a collaborator | +| [**getScoreCollaborators()**](ScoreApi.md#getScoreCollaborators) | **GET** /scores/{score}/collaborators | List the collaborators | +| [**getScoreComments()**](ScoreApi.md#getScoreComments) | **GET** /scores/{score}/comments | List comments | +| [**getScoreRevision()**](ScoreApi.md#getScoreRevision) | **GET** /scores/{score}/revisions/{revision} | Get a score revision | +| [**getScoreRevisionData()**](ScoreApi.md#getScoreRevisionData) | **GET** /scores/{score}/revisions/{revision}/{format} | Get a score revision data | +| [**getScoreRevisions()**](ScoreApi.md#getScoreRevisions) | **GET** /scores/{score}/revisions | List the revisions | +| [**getScoreSubmissions()**](ScoreApi.md#getScoreSubmissions) | **GET** /scores/{score}/submissions | List submissions related to the score | +| [**getScoreTrack()**](ScoreApi.md#getScoreTrack) | **GET** /scores/{score}/tracks/{track} | Retrieve the details of an audio or video track linked to a score | +| [**getUserLikes()**](ScoreApi.md#getUserLikes) | **GET** /users/{user}/likes | List liked scores | +| [**getUserScores()**](ScoreApi.md#getUserScores) | **GET** /users/{user}/scores | List user's scores | +| [**listScoreTracks()**](ScoreApi.md#listScoreTracks) | **GET** /scores/{score}/tracks | List the audio or video tracks linked to a score | +| [**markScoreCommentResolved()**](ScoreApi.md#markScoreCommentResolved) | **PUT** /scores/{score}/comments/{comment}/resolved | Mark the comment as resolved | +| [**markScoreCommentUnresolved()**](ScoreApi.md#markScoreCommentUnresolved) | **DELETE** /scores/{score}/comments/{comment}/resolved | Mark the comment as unresolved | +| [**postScoreComment()**](ScoreApi.md#postScoreComment) | **POST** /scores/{score}/comments | Post a new comment | +| [**removeScoreCollaborator()**](ScoreApi.md#removeScoreCollaborator) | **DELETE** /scores/{score}/collaborators/{collaborator} | Delete a collaborator | +| [**untrashScore()**](ScoreApi.md#untrashScore) | **POST** /scores/{score}/untrash | Untrash a score | +| [**updateScoreComment()**](ScoreApi.md#updateScoreComment) | **PUT** /scores/{score}/comments/{comment} | Update an existing comment | +| [**updateScoreTrack()**](ScoreApi.md#updateScoreTrack) | **PUT** /scores/{score}/tracks/{track} | Update an audio or video track linked to a score | + + +## `addScoreCollaborator()` + +```php +addScoreCollaborator($score, $body): \Flat\APIClient\Model\ResourceCollaborator +``` + +Add a new collaborator + +Share a score with a single user or a group. This API call allows to add, invite and update the collaborators of a resource. - To add an existing Flat user to the resource, specify its unique identifier in the `user` property. - To invite an external user to the resource, specify its email in the `userEmail` property. - To add a Flat group to the resource, specify its unique identifier in the `group` property. - To update an existing collaborator, process the same request with different rights. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$body = new \Flat\APIClient\Model\ResourceCollaboratorCreation(); // \Flat\APIClient\Model\ResourceCollaboratorCreation + +try { + $result = $apiInstance->addScoreCollaborator($score, $body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->addScoreCollaborator: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **body** | [**\Flat\APIClient\Model\ResourceCollaboratorCreation**](../Model/ResourceCollaboratorCreation.md)| | | + +### Return type + +[**\Flat\APIClient\Model\ResourceCollaborator**](../Model/ResourceCollaborator.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `addScoreTrack()` + +```php +addScoreTrack($score, $body): \Flat\APIClient\Model\ScoreTrackCreationResponse +``` + +Add a new video or audio track to the score + +Use this method to add new track to the score. This track can then be played on flat.io or in an embedded score. This API method support medias hosted on SoundCloud, YouTube and Vimeo. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$body = new \Flat\APIClient\Model\ScoreTrackCreation(); // \Flat\APIClient\Model\ScoreTrackCreation + +try { + $result = $apiInstance->addScoreTrack($score, $body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->addScoreTrack: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **body** | [**\Flat\APIClient\Model\ScoreTrackCreation**](../Model/ScoreTrackCreation.md)| | | + +### Return type + +[**\Flat\APIClient\Model\ScoreTrackCreationResponse**](../Model/ScoreTrackCreationResponse.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createExportTask()` + +```php +createExportTask($score, $revision, $format, $sharing_key, $body): \Flat\APIClient\Model\Task +``` + +Create a new score export task + +Some of the exports of a score takes are longer to process than a simple API requests. Use this endpoint to launch a new export of one score hosted on Flat. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$revision = 'revision_example'; // string | Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. +$format = 'format_example'; // string | The format of the file that will be generated or the target service name where the file will be exported +$sharing_key = 'sharing_key_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. +$body = new \Flat\APIClient\Model\TaskExportOptions(); // \Flat\APIClient\Model\TaskExportOptions + +try { + $result = $apiInstance->createExportTask($score, $revision, $format, $sharing_key, $body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->createExportTask: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **revision** | **string**| Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. | | +| **format** | **string**| The format of the file that will be generated or the target service name where the file will be exported | | +| **sharing_key** | **string**| This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. | [optional] | +| **body** | [**\Flat\APIClient\Model\TaskExportOptions**](../Model/TaskExportOptions.md)| | [optional] | + +### Return type + +[**\Flat\APIClient\Model\Task**](../Model/Task.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createScore()` + +```php +createScore($body): \Flat\APIClient\Model\ScoreDetails +``` + +Create a new score + +Use this API method to **create a new music score in the current User account**. This API endpoints provides 3 ways to create scores: * `ScoreCreationBuilderData` : Create a blank score by providing the list of instruments to use. You can optionally customize the initial key signature, time signature, enable TABs, Chord grids, as well as the page layout. * `ScoreCreationFileImport`: Import a file to create the new Flat document. **Preferred formats**: * **MusicXML**: `.xml`, `.musicxml`, `.mxl` (compressed) — MIME: `vnd.recordare.musicxml+xml`, `vnd.recordare.musicxml`. This is the only format that preserves all notation data (articulations, dynamics, layout, etc.) with full round-trip support. * **MIDI**: `.mid`, `.midi` — MIME: `audio/midi`. Only preserves pitch, timing, and instrument data; notation details are lost. **Also supported** (converted to MusicXML on import, some notation details may be lost): * **Guitar Pro**: `.gp`, `.gp3`, `.gp4`, `.gp5`, `.gpx`, `.gtp` * **MuseScore**: `.mscz`, `.mscx` * **Finale**: `.musx` * **ABC notation**: `.abc` — MIME: `text/vnd.abc` * **PowerTab**: `.ptb` * **Capella**: `.cap`, `.capx` * **MEI**: `.mei` * **Overture**: `.ove` * **TablEdit**: `.tef` * **Band-in-a-Box**: `.mgu`, `.sgu` * **Karaoke MIDI**: `.kar` * **MuseData**: `.md` * **Score Writer**: `.scw` * **Bagpipe Music Writer**: `.bmw`, `.bww` * **Encore**: `.enc` **Scanned music** (requires `supportsTasks`, runs our music recognition and spends credits): * **PDF**: `.pdf` * **Images**: `.jpg`, `.png`, `.webp`, `.tiff`, `.gif`, `.avif`, `.heic`, `.heif` The file is identified by its own content, so its extension and any declared type do not have to match. **One file per request**: a multi-page PDF or a multi-frame TIFF is fine, but several separate images of the same score (a page photographed at a time) need `createOmrJob`, which takes many inputs in one job and bills them as a single document. Its live limits are served by `getOmrCapabilities`. * `ScoreCreationGoogleDriveImport`: Import an existing Google Drive file from the connected Google Drive account. This API call will automatically create the first revision of the document, the score can be modified by the using our web application or by uploading a new revision of this file (`POST /v2/scores/{score}/revisions/{revision}`). The currently authenticated user will be granted owner of the file and will be able to add other collaborators (users and groups). If no `collection` is specified, the API will create the score in the most appropriate collection. When using an OAuth2 access token or a personal token, the score will be automatically added to your dedicated app collection in the account (`/v2/collections/app`). If a `collection` is specified and this one has more public privacy settings than the score (e.g. `public` vs `private` for the score), the privacy settings of the created score will be adjusted to the collection ones. You can check the adjusted privacy settings in the returned score `privacy`, and optionally adjust these settings if needed using `PUT /scores/{score}`. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$body = new \Flat\APIClient\Model\ScoreCreationBuilderData(); // \Flat\APIClient\Model\ScoreCreation + +try { + $result = $apiInstance->createScore($body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->createScore: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **body** | [**\Flat\APIClient\Model\ScoreCreation**](../Model/ScoreCreation.md)| | | + +### Return type + +[**\Flat\APIClient\Model\ScoreDetails**](../Model/ScoreDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createScoreRevision()` + +```php +createScoreRevision($score, $body): \Flat\APIClient\Model\ScoreRevision +``` + +Create a new revision + +Update a score by uploading a new revision for this one. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$body = new \Flat\APIClient\Model\ScoreRevisionCreation(); // \Flat\APIClient\Model\ScoreRevisionCreation + +try { + $result = $apiInstance->createScoreRevision($score, $body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->createScoreRevision: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **body** | [**\Flat\APIClient\Model\ScoreRevisionCreation**](../Model/ScoreRevisionCreation.md)| | | + +### Return type + +[**\Flat\APIClient\Model\ScoreRevision**](../Model/ScoreRevision.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteScore()` + +```php +deleteScore($score, $now) +``` + +Delete a score + +This method can be used by anyone that has at least read access to the document: - When called by an owner/admin, it will schedule the deletion of the score, its revisions, and complete history. The score won't be accessible anymore after calling this method and the user's quota will directly be updated. - When called by a collaborator, the score will be unshared (i.e. removed from the account & own collections). - When called by another user that has the score in its collections, the score will be removed from all the user collections. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$now = false; // bool | If `true`, the score deletion will be scheduled to be done ASAP + +try { + $apiInstance->deleteScore($score, $now); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->deleteScore: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **now** | **bool**| If `true`, the score deletion will be scheduled to be done ASAP | [optional] [default to false] | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteScoreComment()` + +```php +deleteScoreComment($score, $comment, $event_properties, $sharing_key) +``` + +Delete a comment + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$comment = 'comment_example'; // string | Unique identifier of a sheet music comment +$event_properties = {"context":"discover","screenLevel0":"home","screenRoute":"/discover"}; // string | Optional analytics properties merged into XP tracking for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` +$sharing_key = 'sharing_key_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. + +try { + $apiInstance->deleteScoreComment($score, $comment, $event_properties, $sharing_key); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->deleteScoreComment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **comment** | **string**| Unique identifier of a sheet music comment | | +| **event_properties** | **string**| Optional analytics properties merged into XP tracking for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` | [optional] | +| **sharing_key** | **string**| This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/x-www-form-urlencoded` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteScoreTrack()` + +```php +deleteScoreTrack($score, $track) +``` + +Remove an audio or video track linked to the score + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$track = 'track_example'; // string | Unique identifier of a score audio track + +try { + $apiInstance->deleteScoreTrack($score, $track); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->deleteScoreTrack: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **track** | **string**| Unique identifier of a score audio track | | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `editScore()` + +```php +editScore($score, $body): \Flat\APIClient\Model\ScoreDetails +``` + +Edit a score's metadata + +This API method allows you to change the metadata of a score document (e.g. its `title` or `privacy`), all the properties are optional. To edit the file itself, create a new revision using the appropriate method (`POST /v2/scores/{score}/revisions/{revision}`). When editing the `title`, `subtitle`, `composer`, `lyricist`, `arranger` or `licenseText`, the metadatas will be instantly be updated, and a real-time action will be pushed to update the document lazily. This pending document modification will be automatically be saved as a new version by either a connected client or our internal versioning service. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$body = new \Flat\APIClient\Model\ScoreModification(); // \Flat\APIClient\Model\ScoreModification + +try { + $result = $apiInstance->editScore($score, $body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->editScore: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **body** | [**\Flat\APIClient\Model\ScoreModification**](../Model/ScoreModification.md)| | | + +### Return type + +[**\Flat\APIClient\Model\ScoreDetails**](../Model/ScoreDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `forkScore()` + +```php +forkScore($score, $body, $sharing_key): \Flat\APIClient\Model\ScoreDetails +``` + +Fork a score + +This API call will make a copy of the last revision of the specified score and create a new score. The copy of the score will have a privacy set to `private`. When using a [Flat for Education](https://flat.io/edu) account, the inline and contextualized comments will be accessible in the child document. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$body = new \Flat\APIClient\Model\ScoreFork(); // \Flat\APIClient\Model\ScoreFork +$sharing_key = 'sharing_key_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. + +try { + $result = $apiInstance->forkScore($score, $body, $sharing_key); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->forkScore: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **body** | [**\Flat\APIClient\Model\ScoreFork**](../Model/ScoreFork.md)| | | +| **sharing_key** | **string**| This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\ScoreDetails**](../Model/ScoreDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getGroupScores()` + +```php +getGroupScores($group, $parent): \Flat\APIClient\Model\ScoreDetails[] +``` + +List group's scores + +Get the list of scores shared with a group. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$group = 'group_example'; // string | Unique identifier of a Flat group +$parent = 'parent_example'; // string | Filter the score forked from the score id `parent` + +try { + $result = $apiInstance->getGroupScores($group, $parent); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->getGroupScores: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **group** | **string**| Unique identifier of a Flat group | | +| **parent** | **string**| Filter the score forked from the score id `parent` | [optional] | + +### Return type + +[**\Flat\APIClient\Model\ScoreDetails[]**](../Model/ScoreDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getScore()` + +```php +getScore($score, $sharing_key): \Flat\APIClient\Model\ScoreDetails +``` + +Get a score's metadata + +Get the details of a score identified by the `score` parameter in the URL. The currently authenticated user must have at least a read access to the document to use this API call. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$sharing_key = 'sharing_key_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. + +try { + $result = $apiInstance->getScore($score, $sharing_key); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->getScore: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **sharing_key** | **string**| This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\ScoreDetails**](../Model/ScoreDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getScoreCollaborator()` + +```php +getScoreCollaborator($score, $collaborator, $sharing_key): \Flat\APIClient\Model\ResourceCollaborator +``` + +Get a collaborator + +Get the information about a collaborator (User or Group). + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$collaborator = 'collaborator_example'; // string | Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** +$sharing_key = 'sharing_key_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. + +try { + $result = $apiInstance->getScoreCollaborator($score, $collaborator, $sharing_key); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->getScoreCollaborator: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **collaborator** | **string**| Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** | | +| **sharing_key** | **string**| This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\ResourceCollaborator**](../Model/ResourceCollaborator.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getScoreCollaborators()` + +```php +getScoreCollaborators($score, $sharing_key): \Flat\APIClient\Model\ResourceCollaborator[] +``` + +List the collaborators + +This API call will list the different collaborators of a score and their rights on the document. The returned list will at least contain the owner of the document. Collaborators can be a single user (the object `user` will be populated) or a group (the object `group` will be populated). + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$sharing_key = 'sharing_key_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. + +try { + $result = $apiInstance->getScoreCollaborators($score, $sharing_key); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->getScoreCollaborators: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **sharing_key** | **string**| This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\ResourceCollaborator[]**](../Model/ResourceCollaborator.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getScoreComments()` + +```php +getScoreComments($score, $type, $sort, $direction, $sharing_key): \Flat\APIClient\Model\ScoreComment[] +``` + +List comments + +This method lists the different comments added on a music score (documents and inline) sorted by their post dates. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$type = 'type_example'; // string | Filter the comments by type +$sort = 'sort_example'; // string | Sort +$direction = 'direction_example'; // string | Sort direction +$sharing_key = 'sharing_key_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. + +try { + $result = $apiInstance->getScoreComments($score, $type, $sort, $direction, $sharing_key); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->getScoreComments: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **type** | **string**| Filter the comments by type | [optional] | +| **sort** | **string**| Sort | [optional] | +| **direction** | **string**| Sort direction | [optional] | +| **sharing_key** | **string**| This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\ScoreComment[]**](../Model/ScoreComment.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getScoreRevision()` + +```php +getScoreRevision($score, $revision, $sharing_key): \Flat\APIClient\Model\ScoreRevision +``` + +Get a score revision + +When creating a score or saving a new version of a score, a revision is created in our storage. This method allows you to get a specific revision metadata. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$revision = 'revision_example'; // string | Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. +$sharing_key = 'sharing_key_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. + +try { + $result = $apiInstance->getScoreRevision($score, $revision, $sharing_key); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->getScoreRevision: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **revision** | **string**| Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. | | +| **sharing_key** | **string**| This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\ScoreRevision**](../Model/ScoreRevision.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getScoreRevisionData()` + +```php +getScoreRevisionData($score, $revision, $format, $sharing_key, $parts, $default_track, $url): \SplFileObject +``` + +Get a score revision data + +Retrieve the file corresponding to a score revision (the following formats are available): Flat JSON/Adagio JSON `json`, MusicXML `mxl`/`xml`, ABC notation `abc`, MP3 `mp3`, WAV `wav`, MIDI `midi`, Flat `flat`, a tumbnail of the first page `thumbnail.png` or auto sync points `synchronizationPoints`. ABC notation is a text format that cannot express everything a score contains. Like MIDI, the export is lossy: notation ABC has no equivalent for is approximated or dropped rather than failing the request. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$revision = 'revision_example'; // string | Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. +$format = 'format_example'; // string | The format of the file you will retrieve +$sharing_key = 'sharing_key_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. +$parts = 'parts_example'; // string | An optional a set of parts uuid to be exported. This parameter must be composed of parts uuids separated by commas. For example \"59df645f-bb1c-f1b4-b573-d2afc4491f94,34ef645f-1aef-f3bc-1564-34cca4492b87\". +$default_track = True; // bool | When `format` is `mp3`, this property is set to true and the score has a default `ScoreTrack` (mp3), this one will be returned instead of the playback file. +$url = True; // bool | Returns a json with the `url` in it instead of redirecting + +try { + $result = $apiInstance->getScoreRevisionData($score, $revision, $format, $sharing_key, $parts, $default_track, $url); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->getScoreRevisionData: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **revision** | **string**| Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. | | +| **format** | **string**| The format of the file you will retrieve | | +| **sharing_key** | **string**| This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. | [optional] | +| **parts** | **string**| An optional a set of parts uuid to be exported. This parameter must be composed of parts uuids separated by commas. For example \"59df645f-bb1c-f1b4-b573-d2afc4491f94,34ef645f-1aef-f3bc-1564-34cca4492b87\". | [optional] | +| **default_track** | **bool**| When `format` is `mp3`, this property is set to true and the score has a default `ScoreTrack` (mp3), this one will be returned instead of the playback file. | [optional] | +| **url** | **bool**| Returns a json with the `url` in it instead of redirecting | [optional] | + +### Return type + +**\SplFileObject** + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json`, `application/vnd.recordare.musicxml+xml`, `application/vnd.recordare.musicxml`, `audio/mp3`, `audio/wav`, `audio/midi`, `image/png`, `application/octet-stream` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getScoreRevisions()` + +```php +getScoreRevisions($score, $sharing_key): \Flat\APIClient\Model\ScoreRevision[] +``` + +List the revisions + +When creating a score or saving a new version of a score, a revision is created in our storage. This method allows you to list all of them, sorted by last modification. Depending the plan of the account, this list can be trunked to the few last revisions. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$sharing_key = 'sharing_key_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. + +try { + $result = $apiInstance->getScoreRevisions($score, $sharing_key); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->getScoreRevisions: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **sharing_key** | **string**| This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\ScoreRevision[]**](../Model/ScoreRevision.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getScoreSubmissions()` + +```php +getScoreSubmissions($score): \Flat\APIClient\Model\AssignmentSubmission[] +``` + +List submissions related to the score + +This API call will list the different assignments submissions where the score is attached. This method can be used by anyone that are part of the organization and have at least read access to the document. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). + +try { + $result = $apiInstance->getScoreSubmissions($score); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->getScoreSubmissions: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | + +### Return type + +[**\Flat\APIClient\Model\AssignmentSubmission[]**](../Model/AssignmentSubmission.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getScoreTrack()` + +```php +getScoreTrack($score, $track, $sharing_key): \Flat\APIClient\Model\ScoreTrack +``` + +Retrieve the details of an audio or video track linked to a score + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$track = 'track_example'; // string | Unique identifier of a score audio track +$sharing_key = 'sharing_key_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. + +try { + $result = $apiInstance->getScoreTrack($score, $track, $sharing_key); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->getScoreTrack: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **track** | **string**| Unique identifier of a score audio track | | +| **sharing_key** | **string**| This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\ScoreTrack**](../Model/ScoreTrack.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getUserLikes()` + +```php +getUserLikes($user, $next, $previous, $limit, $ids): \Flat\APIClient\Model\ScoreDetails[] +``` + +List liked scores + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$user = 'user_example'; // string | Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. +$next = 'next_example'; // string | An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$previous = 'previous_example'; // string | An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$limit = 25; // int | This is the maximum number of objects that may be returned +$ids = True; // bool | Return only the identifiers of the scores + +try { + $result = $apiInstance->getUserLikes($user, $next, $previous, $limit, $ids); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->getUserLikes: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **user** | **string**| Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. | | +| **next** | **string**| An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. | [optional] | +| **previous** | **string**| An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. | [optional] | +| **limit** | **int**| This is the maximum number of objects that may be returned | [optional] [default to 25] | +| **ids** | **bool**| Return only the identifiers of the scores | [optional] | + +### Return type + +[**\Flat\APIClient\Model\ScoreDetails[]**](../Model/ScoreDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getUserScores()` + +```php +getUserScores($user, $paginate, $sort, $direction, $limit, $next, $previous): \Flat\APIClient\Model\ScoreDetails[] +``` + +List user's scores + +Get the list of public scores owned by a User. If you want to access to private scores, please use the [Collections API](#tag/Collection). For example `GET /v2/collections/allScores/scores` to list all recently updated scores. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$user = 'user_example'; // string | Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. +$paginate = false; // bool | When set to `true`, the API will return a paginated result. When set to `false` or unset, the API will return all the scores. If this parameter is unset or false, then limit/sort/direction/next/previous will be ignored. +$sort = 'sort_example'; // string | Sort +$direction = 'direction_example'; // string | Sort direction +$limit = 25; // int | This is the maximum number of objects that may be returned +$next = 'next_example'; // string | An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$previous = 'previous_example'; // string | An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. + +try { + $result = $apiInstance->getUserScores($user, $paginate, $sort, $direction, $limit, $next, $previous); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->getUserScores: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **user** | **string**| Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. | | +| **paginate** | **bool**| When set to `true`, the API will return a paginated result. When set to `false` or unset, the API will return all the scores. If this parameter is unset or false, then limit/sort/direction/next/previous will be ignored. | [optional] [default to false] | +| **sort** | **string**| Sort | [optional] | +| **direction** | **string**| Sort direction | [optional] | +| **limit** | **int**| This is the maximum number of objects that may be returned | [optional] [default to 25] | +| **next** | **string**| An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. | [optional] | +| **previous** | **string**| An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\ScoreDetails[]**](../Model/ScoreDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listScoreTracks()` + +```php +listScoreTracks($score, $sharing_key, $assignment, $list_auto_track): \Flat\APIClient\Model\ScoreTrack[] +``` + +List the audio or video tracks linked to a score + +List all audio or video tracks linked to a score. **Access Control for Performance Submission Tracks:** Tracks with `purpose: 'performanceSubmission'` are filtered based on user role: * **Students**: Can only see their own performance submission tracks, plus all non-performance tracks * **Teachers and score admins**: Can see all tracks from all students The `assignment` query parameter can be used to filter tracks for a specific assignment, but the access control rules above still apply. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$sharing_key = 'sharing_key_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. +$assignment = 'assignment_example'; // string | An assignment id with which all the tracks returned will be related to +$list_auto_track = True; // bool | If true, and if available, return last automatically synchronized Flat's mp3 export as an additional track + +try { + $result = $apiInstance->listScoreTracks($score, $sharing_key, $assignment, $list_auto_track); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->listScoreTracks: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **sharing_key** | **string**| This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. | [optional] | +| **assignment** | **string**| An assignment id with which all the tracks returned will be related to | [optional] | +| **list_auto_track** | **bool**| If true, and if available, return last automatically synchronized Flat's mp3 export as an additional track | [optional] | + +### Return type + +[**\Flat\APIClient\Model\ScoreTrack[]**](../Model/ScoreTrack.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `markScoreCommentResolved()` + +```php +markScoreCommentResolved($score, $comment, $sharing_key) +``` + +Mark the comment as resolved + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$comment = 'comment_example'; // string | Unique identifier of a sheet music comment +$sharing_key = 'sharing_key_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. + +try { + $apiInstance->markScoreCommentResolved($score, $comment, $sharing_key); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->markScoreCommentResolved: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **comment** | **string**| Unique identifier of a sheet music comment | | +| **sharing_key** | **string**| This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `markScoreCommentUnresolved()` + +```php +markScoreCommentUnresolved($score, $comment, $sharing_key) +``` + +Mark the comment as unresolved + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$comment = 'comment_example'; // string | Unique identifier of a sheet music comment +$sharing_key = 'sharing_key_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. + +try { + $apiInstance->markScoreCommentUnresolved($score, $comment, $sharing_key); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->markScoreCommentUnresolved: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **comment** | **string**| Unique identifier of a sheet music comment | | +| **sharing_key** | **string**| This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `postScoreComment()` + +```php +postScoreComment($score, $body, $sharing_key): \Flat\APIClient\Model\ScoreComment +``` + +Post a new comment + +Post a document or a contextualized comment on a document. Please note that this method includes an anti-spam system for public scores. We don't guarantee that your comments will be accepted and displayed to end-user. Comments are be blocked by returning a `403` HTTP error and hidden from other users when the `spam` property is `true`. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$body = new \Flat\APIClient\Model\ScoreCommentCreation(); // \Flat\APIClient\Model\ScoreCommentCreation +$sharing_key = 'sharing_key_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. + +try { + $result = $apiInstance->postScoreComment($score, $body, $sharing_key); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->postScoreComment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **body** | [**\Flat\APIClient\Model\ScoreCommentCreation**](../Model/ScoreCommentCreation.md)| | | +| **sharing_key** | **string**| This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\ScoreComment**](../Model/ScoreComment.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `removeScoreCollaborator()` + +```php +removeScoreCollaborator($score, $collaborator, $event_properties) +``` + +Delete a collaborator + +Remove the specified collaborator from the score + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$collaborator = 'collaborator_example'; // string | Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** +$event_properties = {"context":"discover","screenLevel0":"home","screenRoute":"/discover"}; // string | Optional analytics properties merged into XP tracking for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` + +try { + $apiInstance->removeScoreCollaborator($score, $collaborator, $event_properties); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->removeScoreCollaborator: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **collaborator** | **string**| Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** | | +| **event_properties** | **string**| Optional analytics properties merged into XP tracking for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/x-www-form-urlencoded` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `untrashScore()` + +```php +untrashScore($score) +``` + +Untrash a score + +This method will remove the score from the `trash` collection and from the deletion queue, and add it back to the original collections. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). + +try { + $apiInstance->untrashScore($score); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->untrashScore: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateScoreComment()` + +```php +updateScoreComment($score, $comment, $body, $sharing_key): \Flat\APIClient\Model\ScoreComment +``` + +Update an existing comment + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$comment = 'comment_example'; // string | Unique identifier of a sheet music comment +$body = new \Flat\APIClient\Model\ScoreCommentUpdate(); // \Flat\APIClient\Model\ScoreCommentUpdate +$sharing_key = 'sharing_key_example'; // string | This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. + +try { + $result = $apiInstance->updateScoreComment($score, $comment, $body, $sharing_key); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->updateScoreComment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **comment** | **string**| Unique identifier of a sheet music comment | | +| **body** | [**\Flat\APIClient\Model\ScoreCommentUpdate**](../Model/ScoreCommentUpdate.md)| | | +| **sharing_key** | **string**| This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\ScoreComment**](../Model/ScoreComment.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateScoreTrack()` + +```php +updateScoreTrack($score, $track, $body): \Flat\APIClient\Model\ScoreTrack +``` + +Update an audio or video track linked to a score + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\ScoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$score = 'score_example'; // string | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). +$track = 'track_example'; // string | Unique identifier of a score audio track +$body = new \Flat\APIClient\Model\ScoreTrackUpdate(); // \Flat\APIClient\Model\ScoreTrackUpdate + +try { + $result = $apiInstance->updateScoreTrack($score, $track, $body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ScoreApi->updateScoreTrack: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **score** | **string**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). | | +| **track** | **string**| Unique identifier of a score audio track | | +| **body** | [**\Flat\APIClient\Model\ScoreTrackUpdate**](../Model/ScoreTrackUpdate.md)| | | + +### Return type + +[**\Flat\APIClient\Model\ScoreTrack**](../Model/ScoreTrack.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/reference/Api/TaskApi.md b/docs/reference/Api/TaskApi.md new file mode 100644 index 0000000..f16a8bf --- /dev/null +++ b/docs/reference/Api/TaskApi.md @@ -0,0 +1,68 @@ +# Flat\APIClient\TaskApi + +All URIs are relative to https://api.flat.io/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**getTask()**](TaskApi.md#getTask) | **GET** /tasks/{task} | Get a task details | + + +## `getTask()` + +```php +getTask($task): \Flat\APIClient\Model\Task +``` + +Get a task details + +This method can be used to follow a task progression, for example while a score is being exported. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\TaskApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$task = 'task_example'; // string | Unique identifier for the task + +try { + $result = $apiInstance->getTask($task); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TaskApi->getTask: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **task** | **string**| Unique identifier for the task | | + +### Return type + +[**\Flat\APIClient\Model\Task**](../Model/Task.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/reference/Api/UserApi.md b/docs/reference/Api/UserApi.md new file mode 100644 index 0000000..144a511 --- /dev/null +++ b/docs/reference/Api/UserApi.md @@ -0,0 +1,208 @@ +# Flat\APIClient\UserApi + +All URIs are relative to https://api.flat.io/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**getUser()**](UserApi.md#getUser) | **GET** /users/{user} | Get a public user profile | +| [**getUserLikes()**](UserApi.md#getUserLikes) | **GET** /users/{user}/likes | List liked scores | +| [**getUserScores()**](UserApi.md#getUserScores) | **GET** /users/{user}/scores | List user's scores | + + +## `getUser()` + +```php +getUser($user): \Flat\APIClient\Model\UserPublic +``` + +Get a public user profile + +Get a profile of a Flat or Flat for Education User. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\UserApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$user = 'user_example'; // string | This route parameter is the unique identifier of the user. You can specify an email instead of an unique identifier. If you are executing this request authenticated, you can use `me` as a value instead of the current User unique identifier to work on the current authenticated user. + +try { + $result = $apiInstance->getUser($user); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling UserApi->getUser: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **user** | **string**| This route parameter is the unique identifier of the user. You can specify an email instead of an unique identifier. If you are executing this request authenticated, you can use `me` as a value instead of the current User unique identifier to work on the current authenticated user. | | + +### Return type + +[**\Flat\APIClient\Model\UserPublic**](../Model/UserPublic.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getUserLikes()` + +```php +getUserLikes($user, $next, $previous, $limit, $ids): \Flat\APIClient\Model\ScoreDetails[] +``` + +List liked scores + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\UserApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$user = 'user_example'; // string | Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. +$next = 'next_example'; // string | An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$previous = 'previous_example'; // string | An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$limit = 25; // int | This is the maximum number of objects that may be returned +$ids = True; // bool | Return only the identifiers of the scores + +try { + $result = $apiInstance->getUserLikes($user, $next, $previous, $limit, $ids); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling UserApi->getUserLikes: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **user** | **string**| Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. | | +| **next** | **string**| An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. | [optional] | +| **previous** | **string**| An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. | [optional] | +| **limit** | **int**| This is the maximum number of objects that may be returned | [optional] [default to 25] | +| **ids** | **bool**| Return only the identifiers of the scores | [optional] | + +### Return type + +[**\Flat\APIClient\Model\ScoreDetails[]**](../Model/ScoreDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getUserScores()` + +```php +getUserScores($user, $paginate, $sort, $direction, $limit, $next, $previous): \Flat\APIClient\Model\ScoreDetails[] +``` + +List user's scores + +Get the list of public scores owned by a User. If you want to access to private scores, please use the [Collections API](#tag/Collection). For example `GET /v2/collections/allScores/scores` to list all recently updated scores. + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Flat\APIClient\Api\UserApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$user = 'user_example'; // string | Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. +$paginate = false; // bool | When set to `true`, the API will return a paginated result. When set to `false` or unset, the API will return all the scores. If this parameter is unset or false, then limit/sort/direction/next/previous will be ignored. +$sort = 'sort_example'; // string | Sort +$direction = 'direction_example'; // string | Sort direction +$limit = 25; // int | This is the maximum number of objects that may be returned +$next = 'next_example'; // string | An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. +$previous = 'previous_example'; // string | An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. + +try { + $result = $apiInstance->getUserScores($user, $paginate, $sort, $direction, $limit, $next, $previous); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling UserApi->getUserScores: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **user** | **string**| Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. | | +| **paginate** | **bool**| When set to `true`, the API will return a paginated result. When set to `false` or unset, the API will return all the scores. If this parameter is unset or false, then limit/sort/direction/next/previous will be ignored. | [optional] [default to false] | +| **sort** | **string**| Sort | [optional] | +| **direction** | **string**| Sort direction | [optional] | +| **limit** | **int**| This is the maximum number of objects that may be returned | [optional] [default to 25] | +| **next** | **string**| An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. | [optional] | +| **previous** | **string**| An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. | [optional] | + +### Return type + +[**\Flat\APIClient\Model\ScoreDetails[]**](../Model/ScoreDetails.md) + +### Authorization + +[OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/reference/Model/AddGroupUser200Response.md b/docs/reference/Model/AddGroupUser200Response.md new file mode 100644 index 0000000..ab561fb --- /dev/null +++ b/docs/reference/Model/AddGroupUser200Response.md @@ -0,0 +1,9 @@ +# AddGroupUser200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**user** | **string** | User ID that was added | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/AddGroupUserRequest.md b/docs/reference/Model/AddGroupUserRequest.md new file mode 100644 index 0000000..9edd724 --- /dev/null +++ b/docs/reference/Model/AddGroupUserRequest.md @@ -0,0 +1,9 @@ +# AddGroupUserRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**user** | **string** | ID of the student to add | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ApiAccessToken.md b/docs/reference/Model/ApiAccessToken.md new file mode 100644 index 0000000..9e4bd95 --- /dev/null +++ b/docs/reference/Model/ApiAccessToken.md @@ -0,0 +1,14 @@ +# ApiAccessToken + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of this private token | [optional] +**name** | **string** | Name of the personal access token | [optional] +**token** | **string** | The token. This token will only be returned once, then only the first 4 characters will be returned. | [optional] +**issued_date** | **\DateTime** | The date then this token was issued | [optional] +**expiration_date** | **\DateTime** | The date then this token will expire | [optional] +**scopes** | [**\Flat\APIClient\Model\AppScopes[]**](AppScopes.md) | The list of scopes associated to the token | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/AppScopes.md b/docs/reference/Model/AppScopes.md new file mode 100644 index 0000000..0c92245 --- /dev/null +++ b/docs/reference/Model/AppScopes.md @@ -0,0 +1,8 @@ +# AppScopes + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/Assignment.md b/docs/reference/Model/Assignment.md new file mode 100644 index 0000000..49b5291 --- /dev/null +++ b/docs/reference/Model/Assignment.md @@ -0,0 +1,33 @@ +# Assignment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of the assignment | +**type** | [**\Flat\APIClient\Model\AssignmentType**](AssignmentType.md) | | +**capabilities** | [**\Flat\APIClient\Model\AssignmentCapabilities**](AssignmentCapabilities.md) | | +**title** | **string** | Title of the assignment | +**description** | **string** | Student instructions and content of the assignment (plain text) | [optional] +**description_html** | **string** | HTML version of student instructions with rich text formatting. Supports the following HTML tags: p, br, strong, b, em, i, u, a, ul, ol, li, h1, h2, h3, img. Images are served as absolute http(s) URLs. | [optional] +**teacher_instructions** | **string** | Teacher-only instructions for this assignment. These instructions are only visible to teachers and are not returned when students view the assignment. If `teacherInstructionsHtml` is provided, this field will contain the plain text version for compatibility. | [optional] +**teacher_instructions_html** | **string** | HTML version of teacher-only instructions with rich text formatting. Supports the following HTML tags: p, br, strong, b, em, i, u, a, ul, ol, li, h1, h2, h3, img. Images are served as absolute http(s) URLs. | [optional] +**cover** | **string** | The URL of the cover to display | [optional] +**cover_file** | **string** | The id of the cover to display | [optional] +**attachments** | [**\Flat\APIClient\Model\MediaAttachment[]**](MediaAttachment.md) | Reference material handed to the students with the assignment: scores, videos, links and Drive files. A score attached here is the one each student receives their own copy of. | +**use_dedicated_attachments** | **bool** | For all assignments created after 02/2023, all the underlying resources must be dedicated and stored in the assignment. This boolean indicates that this assignment only supports dedicated attachments. | [optional] +**max_points** | **float** | If set, the grading will be enabled for the assignement | [optional] +**release_grades** | **string** | For worksheets, how grading will work for the assignment: - If set to `auto`, the grades will be automatically released when the student submits the submissions - If set to `manual`, the grades will only be set as `draftGrade` and will be released when the teacher returns the submissions | [optional] +**shuffle_exercises** | **bool** | Mixing worksheets exercises for each student | [optional] +**toolset** | **string** | The id of the associated toolset | [optional] +**nb_playback_authorized** | **float** | The number of playback authorized on the scores of the assignment. | [optional] +**restrict_play_note** | **bool** | Restrict the ability to get an audio feedback every time a student adds or selects a note. | [optional] +**restrict_to_audio_tracks** | **bool** | Restrict the audio source to provided audio tracks on a score. Students won't be able to use the editor playback. | [optional] +**submission_students_mode** | [**\Flat\APIClient\Model\AssignmentSubmissionStudentsMode**](AssignmentSubmissionStudentsMode.md) | | [optional] +**recording_type** | **string** | For performance assignments: recording type that will be either 'audio' or 'video'. * `audio`: Only audio will be required during the recording. * `video`: Camera will be required during the recording. Only set when type is 'performance'. | [optional] +**allow_metronome** | **bool** | For performance assignments: Enable students to use the metronome while they are recording, helping them stay in time. Only set when type is 'performance'. | [optional] +**allow_backing_track** | **bool** | For performance assignments: Enable students to listen to the accompaniment without their instrument part while they are playing. Only set when type is 'performance'. | [optional] +**allow_speed_change** | **bool** | For performance assignments: whether students can adjust the playback speed of the score during recording. * `true`: Students can change the tempo/speed during practice and recording * `false`: Tempo is fixed to the original score tempo Only set when type is 'performance'. | [optional] +**free_record** | **bool** | For performance assignments: \"Free Record\" mode. When `true`, no score is attached to the assignment. Students freely record a varied repertoire or an ensemble performance without being constrained by a single score's structure or duration, and all score-dependent options (playback, metronome, backtracking, speed control) are hidden. Only set when type is 'performance'. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/AssignmentCapabilities.md b/docs/reference/Model/AssignmentCapabilities.md new file mode 100644 index 0000000..440cb4f --- /dev/null +++ b/docs/reference/Model/AssignmentCapabilities.md @@ -0,0 +1,13 @@ +# AssignmentCapabilities + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**can_edit** | **bool** | Whether the current user can edit the assignment | +**can_publish_in_class** | **bool** | Whether this assignment can be published in a class | +**can_publish_in_class_error** | [**\Flat\APIClient\Model\AssignmentCapabilitiesCanPublishInClassError**](AssignmentCapabilitiesCanPublishInClassError.md) | | [optional] +**can_archive** | **bool** | Whether the current user can archive the assignment | +**can_unarchive** | **bool** | Whether the current user can unarchive the assignment | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/AssignmentCapabilitiesCanPublishInClassError.md b/docs/reference/Model/AssignmentCapabilitiesCanPublishInClassError.md new file mode 100644 index 0000000..00d5dde --- /dev/null +++ b/docs/reference/Model/AssignmentCapabilitiesCanPublishInClassError.md @@ -0,0 +1,10 @@ +# AssignmentCapabilitiesCanPublishInClassError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **string** | A corresponding code for this error | +**message** | **string** | A printable and localized message for this error | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/AssignmentCopy.md b/docs/reference/Model/AssignmentCopy.md new file mode 100644 index 0000000..a39a75b --- /dev/null +++ b/docs/reference/Model/AssignmentCopy.md @@ -0,0 +1,11 @@ +# AssignmentCopy + +This model is a `oneOf` wrapper: a value is exactly one of the member types listed below. +It is never instantiated directly — use one of the concrete types. + +## oneOf + +- [**\Flat\APIClient\Model\AssignmentCopyToClass**](AssignmentCopyToClass.md) +- [**\Flat\APIClient\Model\AssignmentCopyToResourceLibrary**](AssignmentCopyToResourceLibrary.md) + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/AssignmentCopyResponse.md b/docs/reference/Model/AssignmentCopyResponse.md new file mode 100644 index 0000000..00e709e --- /dev/null +++ b/docs/reference/Model/AssignmentCopyResponse.md @@ -0,0 +1,34 @@ +# AssignmentCopyResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of the assignment | +**type** | [**\Flat\APIClient\Model\AssignmentType**](AssignmentType.md) | | +**capabilities** | [**\Flat\APIClient\Model\AssignmentCapabilities**](AssignmentCapabilities.md) | | +**title** | **string** | Title of the assignment | +**description** | **string** | Student instructions and content of the assignment (plain text) | [optional] +**description_html** | **string** | HTML version of student instructions with rich text formatting. Supports the following HTML tags: p, br, strong, b, em, i, u, a, ul, ol, li, h1, h2, h3, img. Images are served as absolute http(s) URLs. | [optional] +**teacher_instructions** | **string** | Teacher-only instructions for this assignment. These instructions are only visible to teachers and are not returned when students view the assignment. If `teacherInstructionsHtml` is provided, this field will contain the plain text version for compatibility. | [optional] +**teacher_instructions_html** | **string** | HTML version of teacher-only instructions with rich text formatting. Supports the following HTML tags: p, br, strong, b, em, i, u, a, ul, ol, li, h1, h2, h3, img. Images are served as absolute http(s) URLs. | [optional] +**cover** | **string** | The URL of the cover to display | [optional] +**cover_file** | **string** | The id of the cover to display | [optional] +**attachments** | [**\Flat\APIClient\Model\MediaAttachment[]**](MediaAttachment.md) | Reference material handed to the students with the assignment: scores, videos, links and Drive files. A score attached here is the one each student receives their own copy of. | +**use_dedicated_attachments** | **bool** | For all assignments created after 02/2023, all the underlying resources must be dedicated and stored in the assignment. This boolean indicates that this assignment only supports dedicated attachments. | [optional] +**max_points** | **float** | If set, the grading will be enabled for the assignement | [optional] +**release_grades** | **string** | For worksheets, how grading will work for the assignment: - If set to `auto`, the grades will be automatically released when the student submits the submissions - If set to `manual`, the grades will only be set as `draftGrade` and will be released when the teacher returns the submissions | [optional] +**shuffle_exercises** | **bool** | Mixing worksheets exercises for each student | [optional] +**toolset** | **string** | The id of the associated toolset | [optional] +**nb_playback_authorized** | **float** | The number of playback authorized on the scores of the assignment. | [optional] +**restrict_play_note** | **bool** | Restrict the ability to get an audio feedback every time a student adds or selects a note. | [optional] +**restrict_to_audio_tracks** | **bool** | Restrict the audio source to provided audio tracks on a score. Students won't be able to use the editor playback. | [optional] +**submission_students_mode** | [**\Flat\APIClient\Model\AssignmentSubmissionStudentsMode**](AssignmentSubmissionStudentsMode.md) | | [optional] +**recording_type** | **string** | For performance assignments: recording type that will be either 'audio' or 'video'. * `audio`: Only audio will be required during the recording. * `video`: Camera will be required during the recording. Only set when type is 'performance'. | [optional] +**allow_metronome** | **bool** | For performance assignments: Enable students to use the metronome while they are recording, helping them stay in time. Only set when type is 'performance'. | [optional] +**allow_backing_track** | **bool** | For performance assignments: Enable students to listen to the accompaniment without their instrument part while they are playing. Only set when type is 'performance'. | [optional] +**allow_speed_change** | **bool** | For performance assignments: whether students can adjust the playback speed of the score during recording. * `true`: Students can change the tempo/speed during practice and recording * `false`: Tempo is fixed to the original score tempo Only set when type is 'performance'. | [optional] +**free_record** | **bool** | For performance assignments: \"Free Record\" mode. When `true`, no score is attached to the assignment. Students freely record a varied repertoire or an ensemble performance without being constrained by a single score's structure or duration, and all score-dependent options (playback, metronome, backtracking, speed control) are hidden. Only set when type is 'performance'. | [optional] +**resource** | **string** | If this assignment is stored as a resource in the Flat for Education Resource Library, the unique identifier of the resource. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/AssignmentCopyToClass.md b/docs/reference/Model/AssignmentCopyToClass.md new file mode 100644 index 0000000..8293bda --- /dev/null +++ b/docs/reference/Model/AssignmentCopyToClass.md @@ -0,0 +1,11 @@ +# AssignmentCopyToClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**classroom** | **string** | The destination classroom where the assignment will be copied | +**assignment** | **string** | An optional destination assignment where the original assignement will be copied. Must be a draft. | [optional] +**scheduled_date** | **\DateTime** | The publication (scheduled) date of the assignment. If this one is specified, the assignment will only be listed to the teachers of the class. Alternatively the existing `scheduledDate` from the copied assignment will be used. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/AssignmentCopyToResourceLibrary.md b/docs/reference/Model/AssignmentCopyToResourceLibrary.md new file mode 100644 index 0000000..43cd2d5 --- /dev/null +++ b/docs/reference/Model/AssignmentCopyToResourceLibrary.md @@ -0,0 +1,10 @@ +# AssignmentCopyToResourceLibrary + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**library_parent** | **string** | Identifier of the parent resource where the new one will created, e.g. a folder id or `root` | +**verify_if_not_already_in_resource_library** | **bool** | Option to check if the assignment is already in Resource Library | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/AssignmentGroup.md b/docs/reference/Model/AssignmentGroup.md new file mode 100644 index 0000000..ba4c1a2 --- /dev/null +++ b/docs/reference/Model/AssignmentGroup.md @@ -0,0 +1,12 @@ +# AssignmentGroup + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The unique identifier of the group | +**name** | **string** | The display name of the group | +**parent** | **string** | The unique identifier of the parent class group. Only available for groups of type 'assignmentStudentsSubGroup'. May be null if the parent class group was deleted. | [optional] +**members** | **string[]** | Array of user IDs that are members of this group | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/AssignmentSubmission.md b/docs/reference/Model/AssignmentSubmission.md new file mode 100644 index 0000000..d0620ee --- /dev/null +++ b/docs/reference/Model/AssignmentSubmission.md @@ -0,0 +1,27 @@ +# AssignmentSubmission + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of the submission | +**state** | [**\Flat\APIClient\Model\AssignmentSubmissionState**](AssignmentSubmissionState.md) | | +**classroom** | **string** | Unique identifier of the classroom where the assignment was posted | +**assignment** | **string** | Unique identifier of the assignment | +**creator** | **string** | The User identifier of the student who created the submission | +**creation_date** | **string** | The date when the submission was created | +**attachments** | [**\Flat\APIClient\Model\MediaAttachment[]**](MediaAttachment.md) | | +**submission_date** | **string** | The date when the student submitted their work | [optional] +**return_date** | **string** | The date when the teacher returned the work | [optional] +**return_creator** | **string** | The User unique identifier of the teacher who returned the submission | [optional] +**grade** | **float** | Optional grade. If unset, no grade was set. | [optional] +**draft_grade** | **float** | Optional grade. If unset, no grade was set. This value is only visible by the teacher, and we will be set to `grade` once the teacher returns the submission | [optional] +**max_points** | **float** | Optional max points for the grade. If set, a corresponding `draftGrade` or `grade` will be set. | [optional] +**exercises_ids** | **string[]** | The ids of exercises when they need to be in a specific order | [optional] +**playback** | [**\Flat\APIClient\Model\AssignmentSubmissionPlayback[]**](AssignmentSubmissionPlayback.md) | | +**comments** | [**\Flat\APIClient\Model\AssignmentSubmissionComments**](AssignmentSubmissionComments.md) | | +**google_classroom** | [**\Flat\APIClient\Model\GoogleClassroomSubmission**](GoogleClassroomSubmission.md) | | [optional] +**microsoft_graph** | [**\Flat\APIClient\Model\MicrosoftGraphSubmission**](MicrosoftGraphSubmission.md) | | [optional] +**lti** | [**\Flat\APIClient\Model\AssignmentSubmissionLti**](AssignmentSubmissionLti.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/AssignmentSubmissionComment.md b/docs/reference/Model/AssignmentSubmissionComment.md new file mode 100644 index 0000000..749a119 --- /dev/null +++ b/docs/reference/Model/AssignmentSubmissionComment.md @@ -0,0 +1,15 @@ +# AssignmentSubmissionComment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The comment unique identifier | [optional] +**user** | **string** | The author unique identifier | [optional] +**submission** | **string** | The submission unique identifier | [optional] +**date** | **\DateTime** | The date when the comment was posted | [optional] +**modification_date** | **\DateTime** | The date of the last comment modification | [optional] +**comment** | **string** | The comment text | [optional] +**unread** | **bool** | True if the comment is unread by the current user | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/AssignmentSubmissionCommentCreation.md b/docs/reference/Model/AssignmentSubmissionCommentCreation.md new file mode 100644 index 0000000..ec02779 --- /dev/null +++ b/docs/reference/Model/AssignmentSubmissionCommentCreation.md @@ -0,0 +1,9 @@ +# AssignmentSubmissionCommentCreation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**comment** | **string** | The comment text | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/AssignmentSubmissionComments.md b/docs/reference/Model/AssignmentSubmissionComments.md new file mode 100644 index 0000000..540077a --- /dev/null +++ b/docs/reference/Model/AssignmentSubmissionComments.md @@ -0,0 +1,10 @@ +# AssignmentSubmissionComments + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total** | **float** | The total number of comments added to the submission | [optional] +**unread** | **float** | The number of unread comments for the current user | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/AssignmentSubmissionHistory.md b/docs/reference/Model/AssignmentSubmissionHistory.md new file mode 100644 index 0000000..2393550 --- /dev/null +++ b/docs/reference/Model/AssignmentSubmissionHistory.md @@ -0,0 +1,21 @@ +# AssignmentSubmissionHistory + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**date** | **\DateTime** | The date when the submission was changed | +**classroom** | **string** | The classroom unique identifier where the submission was changed | [optional] +**assignment** | **string** | The assignment unique identifier where the submission was changed | [optional] +**submission** | **string** | The submission unique identifier | [optional] +**users** | **string[]** | The user(s) unique identifier(s) who made the change | +**source** | **string** | The source of the change if the change was made by a third-party software | [optional] +**state** | [**\Flat\APIClient\Model\AssignmentSubmissionHistoryState**](AssignmentSubmissionHistoryState.md) | | [optional] +**draft_grade** | **float** | The numerator of the grade at this time in the submission grade history | [optional] +**grade** | **float** | The numerator of the grade at this time in the submission grade history | [optional] +**max_points** | **float** | The denominator of the grade at this time in the submission grade history | [optional] +**comment** | **string** | The comment that is made to this submission | [optional] +**due_date** | **\DateTime** | The due date of this assignment | [optional] +**attachment** | [**\Flat\APIClient\Model\AssignmentSubmissionHistoryAttachment**](AssignmentSubmissionHistoryAttachment.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/AssignmentSubmissionHistoryAttachment.md b/docs/reference/Model/AssignmentSubmissionHistoryAttachment.md new file mode 100644 index 0000000..7098d4d --- /dev/null +++ b/docs/reference/Model/AssignmentSubmissionHistoryAttachment.md @@ -0,0 +1,11 @@ +# AssignmentSubmissionHistoryAttachment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**score** | **string** | The score identifier that changed | [optional] +**revision** | **string** | The revision identifier that changed | [optional] +**title** | **string** | The title of the score that changed | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/AssignmentSubmissionHistoryState.md b/docs/reference/Model/AssignmentSubmissionHistoryState.md new file mode 100644 index 0000000..4406d75 --- /dev/null +++ b/docs/reference/Model/AssignmentSubmissionHistoryState.md @@ -0,0 +1,8 @@ +# AssignmentSubmissionHistoryState + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/AssignmentSubmissionLti.md b/docs/reference/Model/AssignmentSubmissionLti.md new file mode 100644 index 0000000..c524801 --- /dev/null +++ b/docs/reference/Model/AssignmentSubmissionLti.md @@ -0,0 +1,10 @@ +# AssignmentSubmissionLti + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**grade_service** | **string** | The kind of grading service available for this submission: - `ags2p0`: LTI 1.3 Assignment and Grade Services 2.0 - `outcomes1p1`: LTI 1.1 Outcomes 1.1 | +**sourcedid** | **string** | The sourcedid of the LTI submission when using LTI Outcomes | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/AssignmentSubmissionPlayback.md b/docs/reference/Model/AssignmentSubmissionPlayback.md new file mode 100644 index 0000000..c48a0cc --- /dev/null +++ b/docs/reference/Model/AssignmentSubmissionPlayback.md @@ -0,0 +1,10 @@ +# AssignmentSubmissionPlayback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**score** | **string** | The score unique identifier | +**nb_play_attempt** | **float** | Number of times the score was played | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/AssignmentSubmissionState.md b/docs/reference/Model/AssignmentSubmissionState.md new file mode 100644 index 0000000..74bcd24 --- /dev/null +++ b/docs/reference/Model/AssignmentSubmissionState.md @@ -0,0 +1,8 @@ +# AssignmentSubmissionState + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/AssignmentSubmissionStudentsMode.md b/docs/reference/Model/AssignmentSubmissionStudentsMode.md new file mode 100644 index 0000000..0c7bd67 --- /dev/null +++ b/docs/reference/Model/AssignmentSubmissionStudentsMode.md @@ -0,0 +1,8 @@ +# AssignmentSubmissionStudentsMode + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/AssignmentSubmissionUpdate.md b/docs/reference/Model/AssignmentSubmissionUpdate.md new file mode 100644 index 0000000..c660c3f --- /dev/null +++ b/docs/reference/Model/AssignmentSubmissionUpdate.md @@ -0,0 +1,15 @@ +# AssignmentSubmissionUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**attachments** | [**\Flat\APIClient\Model\ClassAttachmentCreation[]**](ClassAttachmentCreation.md) | | [optional] +**playback** | [**\Flat\APIClient\Model\AssignmentSubmissionPlayback[]**](AssignmentSubmissionPlayback.md) | | [optional] +**submit** | **bool** | If `true`, the submission will be marked as done | [optional] +**draft_grade** | **float** | Optional grade. If unset, no grade was set. This value is only visible by the teacher, and we will be set to `grade` once the teacher returns the submission | [optional] +**grade** | **float** | Optional grade. If unset, no grade was set. | [optional] +**exercises_ids** | **string[]** | The ids of exercises when they need to be in a specific order | [optional] +**return** | **bool** | If `true`, the submission will be marked as done | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/AssignmentType.md b/docs/reference/Model/AssignmentType.md new file mode 100644 index 0000000..657fc5c --- /dev/null +++ b/docs/reference/Model/AssignmentType.md @@ -0,0 +1,8 @@ +# AssignmentType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/AssignmentUpdate.md b/docs/reference/Model/AssignmentUpdate.md new file mode 100644 index 0000000..dede7f0 --- /dev/null +++ b/docs/reference/Model/AssignmentUpdate.md @@ -0,0 +1,30 @@ +# AssignmentUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**\Flat\APIClient\Model\AssignmentType**](AssignmentType.md) | | [optional] +**title** | **string** | Title of the assignment | [optional] +**description** | **string** | Student instructions and content of the assignment (plain text) | [optional] +**description_html** | **string** | HTML version of student instructions. Pasted images may be sent as inline base64 `data:` URIs; they are uploaded to storage and rewritten to hosted URLs on save. The final HTML is limited to 100000 characters. When provided, the plain text version will be automatically extracted for compatibility. | [optional] +**teacher_instructions** | **string** | Teacher-only instructions (plain text) | [optional] +**teacher_instructions_html** | **string** | HTML version of teacher-only instructions. Pasted images may be sent as inline base64 `data:` URIs; they are uploaded to storage and rewritten to hosted URLs on save. The final HTML is limited to 100000 characters. When provided, the plain text version will be automatically extracted for compatibility. | [optional] +**attachments** | [**\Flat\APIClient\Model\ClassAttachmentCreation[]**](ClassAttachmentCreation.md) | The complete attachment list. Omitting this property on an update leaves the existing attachments alone; sending it replaces them. Dropping a dedicated score from the list deletes the students' copies of it, so send the full set you want to keep rather than only the additions. Duplicates, judged by `url`, `score`, `worksheet` or `googleDriveFileId`, are discarded silently, and exceeding the per-assignment limit fails with `ASSIGNMENT_ATTACHMENTS_LIMIT`. | [optional] +**nb_playback_authorized** | **float** | The number of playback authorized on the scores of the assignment. | [optional] +**restrict_play_note** | **bool** | Restrict the ability to get an audio feedback every time a student adds or selects a note. | [optional] +**restrict_to_audio_tracks** | **bool** | Restrict the audio source to provided audio tracks on a score. Students won't be able to use the editor playback. | [optional] +**toolset** | **string** | The id of the toolset to apply to this assignment. The toolset will be copied to the assignment as a dedicated object to prevent unexpected changes when making modifications to the template toolset. This property can be set to null to delete the linked toolset and switch back to all the tools available for this assignment. | [optional] +**cover_file** | **string** | The id of the cover to display | [optional] +**cover** | **string** | The URL of the cover to display | [optional] +**max_points** | **float** | If set, the grading will be enabled for the assignement with this value as the maximum of points | [optional] +**release_grades** | **string** | For worksheets, how grading will work for the assignment: - If set to `auto`, the grades will be automatically released when the student submits the submissions - If set to `manual`, the grades will only be set as `draftGrade` and will be released when the teacher returns the submissions | [optional] +**shuffle_exercises** | **bool** | Mixing worksheets exercises for each student | [optional] +**submission_students_mode** | [**\Flat\APIClient\Model\AssignmentSubmissionStudentsMode**](AssignmentSubmissionStudentsMode.md) | | [optional] +**recording_type** | **string** | For performance assignments: recording type that will be either 'audio' or 'video'. * `audio`: Only audio will be required during the recording. * `video`: Camera will be required during the recording. Only set when type is 'performance'. | [optional] +**allow_metronome** | **bool** | For performance assignments: Enable students to use the metronome while they are recording, helping them stay in time. Only set when type is 'performance'. | [optional] +**allow_backing_track** | **bool** | For performance assignments: Enable students to listen to the accompaniment without their instrument part while they are playing. Only set when type is 'performance'. | [optional] +**allow_speed_change** | **bool** | For performance assignments: whether students can adjust the playback speed of the score during recording. * `true`: Students can change the tempo/speed during practice and recording * `false`: Tempo is fixed to the original score tempo Only set when type is 'performance'. | [optional] +**free_record** | **bool** | For performance assignments: \"Free Record\" mode. When `true`, no score is attached to the assignment. Students freely record a varied repertoire or an ensemble performance without being constrained by a single score's structure or duration, and all score-dependent options (playback, metronome, backtracking, speed control) are hidden. Only set when type is 'performance'. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ClassAssignment.md b/docs/reference/Model/ClassAssignment.md new file mode 100644 index 0000000..78a937f --- /dev/null +++ b/docs/reference/Model/ClassAssignment.md @@ -0,0 +1,49 @@ +# ClassAssignment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of the assignment | +**type** | [**\Flat\APIClient\Model\AssignmentType**](AssignmentType.md) | | +**capabilities** | [**\Flat\APIClient\Model\AssignmentCapabilities**](AssignmentCapabilities.md) | | +**title** | **string** | Title of the assignment | +**description** | **string** | Student instructions and content of the assignment (plain text) | [optional] +**description_html** | **string** | HTML version of student instructions with rich text formatting. Supports the following HTML tags: p, br, strong, b, em, i, u, a, ul, ol, li, h1, h2, h3, img. Images are served as absolute http(s) URLs. | [optional] +**teacher_instructions** | **string** | Teacher-only instructions for this assignment. These instructions are only visible to teachers and are not returned when students view the assignment. If `teacherInstructionsHtml` is provided, this field will contain the plain text version for compatibility. | [optional] +**teacher_instructions_html** | **string** | HTML version of teacher-only instructions with rich text formatting. Supports the following HTML tags: p, br, strong, b, em, i, u, a, ul, ol, li, h1, h2, h3, img. Images are served as absolute http(s) URLs. | [optional] +**cover** | **string** | The URL of the cover to display | [optional] +**cover_file** | **string** | The id of the cover to display | [optional] +**attachments** | [**\Flat\APIClient\Model\MediaAttachment[]**](MediaAttachment.md) | Reference material handed to the students with the assignment: scores, videos, links and Drive files. A score attached here is the one each student receives their own copy of. | +**use_dedicated_attachments** | **bool** | For all assignments created after 02/2023, all the underlying resources must be dedicated and stored in the assignment. This boolean indicates that this assignment only supports dedicated attachments. | [optional] +**max_points** | **float** | If set, the grading will be enabled for the assignement | [optional] +**release_grades** | **string** | For worksheets, how grading will work for the assignment: - If set to `auto`, the grades will be automatically released when the student submits the submissions - If set to `manual`, the grades will only be set as `draftGrade` and will be released when the teacher returns the submissions | [optional] +**shuffle_exercises** | **bool** | Mixing worksheets exercises for each student | [optional] +**toolset** | **string** | The id of the associated toolset | [optional] +**nb_playback_authorized** | **float** | The number of playback authorized on the scores of the assignment. | [optional] +**restrict_play_note** | **bool** | Restrict the ability to get an audio feedback every time a student adds or selects a note. | [optional] +**restrict_to_audio_tracks** | **bool** | Restrict the audio source to provided audio tracks on a score. Students won't be able to use the editor playback. | [optional] +**submission_students_mode** | [**\Flat\APIClient\Model\AssignmentSubmissionStudentsMode**](AssignmentSubmissionStudentsMode.md) | | [optional] +**recording_type** | **string** | For performance assignments: recording type that will be either 'audio' or 'video'. * `audio`: Only audio will be required during the recording. * `video`: Camera will be required during the recording. Only set when type is 'performance'. | [optional] +**allow_metronome** | **bool** | For performance assignments: Enable students to use the metronome while they are recording, helping them stay in time. Only set when type is 'performance'. | [optional] +**allow_backing_track** | **bool** | For performance assignments: Enable students to listen to the accompaniment without their instrument part while they are playing. Only set when type is 'performance'. | [optional] +**allow_speed_change** | **bool** | For performance assignments: whether students can adjust the playback speed of the score during recording. * `true`: Students can change the tempo/speed during practice and recording * `false`: Tempo is fixed to the original score tempo Only set when type is 'performance'. | [optional] +**free_record** | **bool** | For performance assignments: \"Free Record\" mode. When `true`, no score is attached to the assignment. Students freely record a varied repertoire or an ensemble performance without being constrained by a single score's structure or duration, and all score-dependent options (playback, metronome, backtracking, speed control) are hidden. Only set when type is 'performance'. | [optional] +**creator** | **string** | The User unique identifier of the creator of this assignment | [optional] +**state** | **string** | State of the assignment | +**classroom** | **string** | The unique identifier of the class where this assignment was posted | [optional] +**creation_date** | **\DateTime** | The creation date of this assignment | +**scheduled_date** | **\DateTime** | The publication (scheduled) date of the assignment. If this one is specified, the assignment will only be listed to the teachers of the class. | [optional] +**due_date** | **\DateTime** | The due date of this assignment, late submissions will be marked as paste due. | [optional] +**assignee_mode** | **string** | Possible modes of assigning assignments | [optional] +**assigned_students** | **string[]** | Identifiers for the students that have access to the assignment | [optional] +**assigned_groups** | [**\Flat\APIClient\Model\AssignmentGroup[]**](AssignmentGroup.md) | Groups that have access to the assignment (for shared writing assignments) | [optional] +**submissions** | [**\Flat\APIClient\Model\AssignmentSubmission[]**](AssignmentSubmission.md) | | +**google_classroom** | [**\Flat\APIClient\Model\GoogleClassroomCoursework**](GoogleClassroomCoursework.md) | | [optional] +**microsoft_graph** | [**\Flat\APIClient\Model\MicrosoftGraphAssignment**](MicrosoftGraphAssignment.md) | | [optional] +**mfc** | [**\Flat\APIClient\Model\ClassAssignmentAllOfMfc**](ClassAssignmentAllOfMfc.md) | | [optional] +**canvas** | [**\Flat\APIClient\Model\ClassAssignmentAllOfCanvas**](ClassAssignmentAllOfCanvas.md) | | [optional] +**lti** | [**\Flat\APIClient\Model\ClassAssignmentAllOfLti**](ClassAssignmentAllOfLti.md) | | [optional] +**issue** | **string** | Detected issue for this assignment | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ClassAssignmentAllOfCanvas.md b/docs/reference/Model/ClassAssignmentAllOfCanvas.md new file mode 100644 index 0000000..babe420 --- /dev/null +++ b/docs/reference/Model/ClassAssignmentAllOfCanvas.md @@ -0,0 +1,10 @@ +# ClassAssignmentAllOfCanvas + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of the course on Canvas assignment | [optional] +**alternate_link** | **string** | Link to Canvas assignment | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ClassAssignmentAllOfLti.md b/docs/reference/Model/ClassAssignmentAllOfLti.md new file mode 100644 index 0000000..3b08be5 --- /dev/null +++ b/docs/reference/Model/ClassAssignmentAllOfLti.md @@ -0,0 +1,9 @@ +# ClassAssignmentAllOfLti + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Resource ID in the LMS | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ClassAssignmentAllOfMfc.md b/docs/reference/Model/ClassAssignmentAllOfMfc.md new file mode 100644 index 0000000..149712e --- /dev/null +++ b/docs/reference/Model/ClassAssignmentAllOfMfc.md @@ -0,0 +1,10 @@ +# ClassAssignmentAllOfMfc + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of the course on MusicFirst Task | [optional] +**alternate_link** | **string** | Link to MusicFirst Classroom task | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ClassAssignmentUpdate.md b/docs/reference/Model/ClassAssignmentUpdate.md new file mode 100644 index 0000000..2e1adb2 --- /dev/null +++ b/docs/reference/Model/ClassAssignmentUpdate.md @@ -0,0 +1,38 @@ +# ClassAssignmentUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**\Flat\APIClient\Model\AssignmentType**](AssignmentType.md) | | [optional] +**title** | **string** | Title of the assignment | [optional] +**description** | **string** | Student instructions and content of the assignment (plain text) | [optional] +**description_html** | **string** | HTML version of student instructions. Pasted images may be sent as inline base64 `data:` URIs; they are uploaded to storage and rewritten to hosted URLs on save. The final HTML is limited to 100000 characters. When provided, the plain text version will be automatically extracted for compatibility. | [optional] +**teacher_instructions** | **string** | Teacher-only instructions (plain text) | [optional] +**teacher_instructions_html** | **string** | HTML version of teacher-only instructions. Pasted images may be sent as inline base64 `data:` URIs; they are uploaded to storage and rewritten to hosted URLs on save. The final HTML is limited to 100000 characters. When provided, the plain text version will be automatically extracted for compatibility. | [optional] +**attachments** | [**\Flat\APIClient\Model\ClassAttachmentCreation[]**](ClassAttachmentCreation.md) | The complete attachment list. Omitting this property on an update leaves the existing attachments alone; sending it replaces them. Dropping a dedicated score from the list deletes the students' copies of it, so send the full set you want to keep rather than only the additions. Duplicates, judged by `url`, `score`, `worksheet` or `googleDriveFileId`, are discarded silently, and exceeding the per-assignment limit fails with `ASSIGNMENT_ATTACHMENTS_LIMIT`. | [optional] +**nb_playback_authorized** | **float** | The number of playback authorized on the scores of the assignment. | [optional] +**restrict_play_note** | **bool** | Restrict the ability to get an audio feedback every time a student adds or selects a note. | [optional] +**restrict_to_audio_tracks** | **bool** | Restrict the audio source to provided audio tracks on a score. Students won't be able to use the editor playback. | [optional] +**toolset** | **string** | The id of the toolset to apply to this assignment. The toolset will be copied to the assignment as a dedicated object to prevent unexpected changes when making modifications to the template toolset. This property can be set to null to delete the linked toolset and switch back to all the tools available for this assignment. | [optional] +**cover_file** | **string** | The id of the cover to display | [optional] +**cover** | **string** | The URL of the cover to display | [optional] +**max_points** | **float** | If set, the grading will be enabled for the assignement with this value as the maximum of points | [optional] +**release_grades** | **string** | For worksheets, how grading will work for the assignment: - If set to `auto`, the grades will be automatically released when the student submits the submissions - If set to `manual`, the grades will only be set as `draftGrade` and will be released when the teacher returns the submissions | [optional] +**shuffle_exercises** | **bool** | Mixing worksheets exercises for each student | [optional] +**submission_students_mode** | [**\Flat\APIClient\Model\AssignmentSubmissionStudentsMode**](AssignmentSubmissionStudentsMode.md) | | [optional] +**recording_type** | **string** | For performance assignments: recording type that will be either 'audio' or 'video'. * `audio`: Only audio will be required during the recording. * `video`: Camera will be required during the recording. Only set when type is 'performance'. | [optional] +**allow_metronome** | **bool** | For performance assignments: Enable students to use the metronome while they are recording, helping them stay in time. Only set when type is 'performance'. | [optional] +**allow_backing_track** | **bool** | For performance assignments: Enable students to listen to the accompaniment without their instrument part while they are playing. Only set when type is 'performance'. | [optional] +**allow_speed_change** | **bool** | For performance assignments: whether students can adjust the playback speed of the score during recording. * `true`: Students can change the tempo/speed during practice and recording * `false`: Tempo is fixed to the original score tempo Only set when type is 'performance'. | [optional] +**free_record** | **bool** | For performance assignments: \"Free Record\" mode. When `true`, no score is attached to the assignment. Students freely record a varied repertoire or an ensemble performance without being constrained by a single score's structure or duration, and all score-dependent options (playback, metronome, backtracking, speed control) are hidden. Only set when type is 'performance'. | [optional] +**state** | **string** | State of the assignment | [optional] +**due_date** | **\DateTime** | The due date of this assignment, late submissions will be marked as paste due. If not set, the assignment won't have a due date. | [optional] +**scheduled_date** | **\DateTime** | The publication (scheduled) date of the assignment. If this one is specified, the assignment will only be listed to the teachers of the class. | [optional] +**google_classroom** | [**\Flat\APIClient\Model\ClassAssignmentUpdateAllOfGoogleClassroom**](ClassAssignmentUpdateAllOfGoogleClassroom.md) | | [optional] +**microsoft_graph** | [**\Flat\APIClient\Model\ClassAssignmentUpdateAllOfMicrosoftGraph**](ClassAssignmentUpdateAllOfMicrosoftGraph.md) | | [optional] +**assignee_mode** | **string** | Possible modes of assigning assignments | [optional] +**assigned_students** | **string[]** | Identifiers for the students that have access to the assignment | [optional] +**class_group_ids** | **string[]** | Optional list of specific class group IDs to apply to the assignment. When transitioning to active state with group submission mode: - If provided: Only these specific groups will be applied - If not provided: All class groups will be applied, or randomized groups created if none exist | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ClassAssignmentUpdateAllOfGoogleClassroom.md b/docs/reference/Model/ClassAssignmentUpdateAllOfGoogleClassroom.md new file mode 100644 index 0000000..665ea33 --- /dev/null +++ b/docs/reference/Model/ClassAssignmentUpdateAllOfGoogleClassroom.md @@ -0,0 +1,9 @@ +# ClassAssignmentUpdateAllOfGoogleClassroom + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**topic_id** | **string** | Identifier of the topic where the assignment is created | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ClassAssignmentUpdateAllOfMicrosoftGraph.md b/docs/reference/Model/ClassAssignmentUpdateAllOfMicrosoftGraph.md new file mode 100644 index 0000000..b3384b5 --- /dev/null +++ b/docs/reference/Model/ClassAssignmentUpdateAllOfMicrosoftGraph.md @@ -0,0 +1,9 @@ +# ClassAssignmentUpdateAllOfMicrosoftGraph + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**categories** | **string[]** | List of categories this assignment belongs to | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ClassAttachmentCreation.md b/docs/reference/Model/ClassAttachmentCreation.md new file mode 100644 index 0000000..032ab5a --- /dev/null +++ b/docs/reference/Model/ClassAttachmentCreation.md @@ -0,0 +1,18 @@ +# ClassAttachmentCreation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | The type of the attachment posted: * `rich`, `photo`, `video` are attachment types that are automatically resolved from a `link` attachment. * A `flat` attachment is a score document where the unique identifier will be specified in the `score` property. Its sharing mode will be provided in the `sharingMode` property. | [optional] +**score** | **string** | A unique Flat score identifier. The user creating the assignment must at least have read access to the document. If the user has admin rights, new group permissions will be automatically added for the teachers and students of the class. | [optional] +**worksheet** | **string** | An unique worksheet identifier | [optional] +**revision** | **string** | An unique revision identifier of a score | [optional] +**part_uuid** | **string** | The UUID of the instrument part selected for this attachment (for performance submissions) | [optional] +**sharing_mode** | [**\Flat\APIClient\Model\MediaScoreSharingMode**](MediaScoreSharingMode.md) | | [optional] +**lock_score_template** | **bool** | To be used with a score attached in `sharingMode` `copy` (score used as template). If true, students won't be able to change the original notes of the template. | [optional] +**url** | **string** | The URL of the attachment. | [optional] +**google_drive_file_id** | **string** | The ID of the Google Drive File | [optional] +**teacher_only** | **bool** | Flag indicating if this attachment should only be visible to teachers | [optional] [default to false] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ClassCreation.md b/docs/reference/Model/ClassCreation.md new file mode 100644 index 0000000..352eac0 --- /dev/null +++ b/docs/reference/Model/ClassCreation.md @@ -0,0 +1,13 @@ +# ClassCreation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | The name of the new class | +**section** | **string** | The section of the new class | [optional] +**level** | [**\Flat\APIClient\Model\ClassGradeLevel**](ClassGradeLevel.md) | | [optional] +**skills_focused** | **string[]** | Specific skills that will be focused in classroom | [optional] +**size** | **float** | Number of students in the classroom | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ClassDetails.md b/docs/reference/Model/ClassDetails.md new file mode 100644 index 0000000..bd0528f --- /dev/null +++ b/docs/reference/Model/ClassDetails.md @@ -0,0 +1,33 @@ +# ClassDetails + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The unique identifier of the class | +**state** | [**\Flat\APIClient\Model\ClassState**](ClassState.md) | | +**name** | **string** | The name of the class | +**section** | **string** | The section of the class | [optional] +**description** | **string** | An optionnal description for this class | [optional] +**organization** | **string** | The unique identifier of the Organization owning this class | [optional] +**owner** | **string** | The unique identifier of the User owning this class | [optional] +**creation_date** | **\DateTime** | The date when the class was create | +**modification_date** | **\DateTime** | The date when the class was last modified | [optional] +**enrollment_code** | **string** | [Teachers only] The enrollment code that can be used by the students to join the class | [optional] +**theme** | **string** | The theme identifier using in Flat User Interface | [optional] +**assignments_count** | **float** | The number of assignments created in the class | [optional] +**students_group** | [**\Flat\APIClient\Model\GroupDetails**](GroupDetails.md) | | [optional] +**teachers_group** | [**\Flat\APIClient\Model\GroupDetails**](GroupDetails.md) | | [optional] +**issues** | [**\Flat\APIClient\Model\ClassDetailsIssues**](ClassDetailsIssues.md) | | [optional] +**google_classroom** | [**\Flat\APIClient\Model\ClassDetailsGoogleClassroom**](ClassDetailsGoogleClassroom.md) | | [optional] +**google_drive** | [**\Flat\APIClient\Model\ClassDetailsGoogleDrive**](ClassDetailsGoogleDrive.md) | | [optional] +**microsoft_graph** | [**\Flat\APIClient\Model\ClassDetailsMicrosoftGraph**](ClassDetailsMicrosoftGraph.md) | | [optional] +**lti** | [**\Flat\APIClient\Model\ClassDetailsLti**](ClassDetailsLti.md) | | [optional] +**canvas** | [**\Flat\APIClient\Model\ClassDetailsCanvas**](ClassDetailsCanvas.md) | | [optional] +**mfc** | [**\Flat\APIClient\Model\ClassDetailsMfc**](ClassDetailsMfc.md) | | [optional] +**clever** | [**\Flat\APIClient\Model\ClassDetailsClever**](ClassDetailsClever.md) | | [optional] +**level** | [**\Flat\APIClient\Model\ClassGradeLevel**](ClassGradeLevel.md) | | [optional] +**skills_focused** | **string[]** | Specific skills that will be focused in classroom | [optional] +**size** | **float** | Number of students in the classroom | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ClassDetailsCanvas.md b/docs/reference/Model/ClassDetailsCanvas.md new file mode 100644 index 0000000..940f133 --- /dev/null +++ b/docs/reference/Model/ClassDetailsCanvas.md @@ -0,0 +1,10 @@ +# ClassDetailsCanvas + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of the course on Canvas | [optional] +**domain** | **string** | Canvas instance domain (e.g. \"canvas.instructure.com\") | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ClassDetailsClever.md b/docs/reference/Model/ClassDetailsClever.md new file mode 100644 index 0000000..2406105 --- /dev/null +++ b/docs/reference/Model/ClassDetailsClever.md @@ -0,0 +1,15 @@ +# ClassDetailsClever + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Clever section unique identifier | [optional] +**creation_date** | **\DateTime** | The creation date of the section on clever | [optional] +**modification_date** | **\DateTime** | The last modification date of the section on clever | [optional] +**subject** | **string** | Normalized subject of the course | [optional] +**term_name** | **string** | Name of the term when this course happens | [optional] +**term_start_date** | **\DateTime** | Beginning date of the term | [optional] +**term_end_date** | **\DateTime** | End date of the term | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ClassDetailsGoogleClassroom.md b/docs/reference/Model/ClassDetailsGoogleClassroom.md new file mode 100644 index 0000000..523a9d0 --- /dev/null +++ b/docs/reference/Model/ClassDetailsGoogleClassroom.md @@ -0,0 +1,10 @@ +# ClassDetailsGoogleClassroom + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The course identifier on Google Classroom | [optional] +**alternate_link** | **string** | Absolute link to this course in the Classroom web UI | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ClassDetailsGoogleDrive.md b/docs/reference/Model/ClassDetailsGoogleDrive.md new file mode 100644 index 0000000..1eabf23 --- /dev/null +++ b/docs/reference/Model/ClassDetailsGoogleDrive.md @@ -0,0 +1,10 @@ +# ClassDetailsGoogleDrive + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**teacher_folder_id** | **string** | [Teachers only] The Drive directory identifier of the teachers' folder | [optional] +**teacher_folder_alternate_link** | **string** | [Teachers only] The Drive URL of the teachers' folder | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ClassDetailsIssues.md b/docs/reference/Model/ClassDetailsIssues.md new file mode 100644 index 0000000..1bb6150 --- /dev/null +++ b/docs/reference/Model/ClassDetailsIssues.md @@ -0,0 +1,9 @@ +# ClassDetailsIssues + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sync** | [**\Flat\APIClient\Model\ClassDetailsIssuesSyncInner[]**](ClassDetailsIssuesSyncInner.md) | Synchronization issues for the class | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ClassDetailsIssuesSyncInner.md b/docs/reference/Model/ClassDetailsIssuesSyncInner.md new file mode 100644 index 0000000..69f3fdc --- /dev/null +++ b/docs/reference/Model/ClassDetailsIssuesSyncInner.md @@ -0,0 +1,11 @@ +# ClassDetailsIssuesSyncInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The account user identifier | [optional] +**email** | **string** | The email address of the user concerned by this sync issue | [optional] +**reason** | **string** | The reason why the account cannot be synced | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ClassDetailsLti.md b/docs/reference/Model/ClassDetailsLti.md new file mode 100644 index 0000000..7098776 --- /dev/null +++ b/docs/reference/Model/ClassDetailsLti.md @@ -0,0 +1,12 @@ +# ClassDetailsLti + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**context_id** | **string** | Unique context identifier provided | [optional] +**context_title** | **string** | Context title | [optional] +**context_label** | **string** | Context label | [optional] +**has_nrps_service** | **bool** | If true, the class has been synchronized with the LTI 1.3 NRPS 2.0 service | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ClassDetailsMfc.md b/docs/reference/Model/ClassDetailsMfc.md new file mode 100644 index 0000000..c8973d3 --- /dev/null +++ b/docs/reference/Model/ClassDetailsMfc.md @@ -0,0 +1,10 @@ +# ClassDetailsMfc + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of the course on MusicFirst Classroom | [optional] +**alternate_link** | **string** | Link to MusicFirst Classroom class | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ClassDetailsMicrosoftGraph.md b/docs/reference/Model/ClassDetailsMicrosoftGraph.md new file mode 100644 index 0000000..5552c70 --- /dev/null +++ b/docs/reference/Model/ClassDetailsMicrosoftGraph.md @@ -0,0 +1,9 @@ +# ClassDetailsMicrosoftGraph + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The course identifier on Microsoft Graph | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ClassGradeLevel.md b/docs/reference/Model/ClassGradeLevel.md new file mode 100644 index 0000000..94c9891 --- /dev/null +++ b/docs/reference/Model/ClassGradeLevel.md @@ -0,0 +1,8 @@ +# ClassGradeLevel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ClassRoles.md b/docs/reference/Model/ClassRoles.md new file mode 100644 index 0000000..4722968 --- /dev/null +++ b/docs/reference/Model/ClassRoles.md @@ -0,0 +1,8 @@ +# ClassRoles + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ClassState.md b/docs/reference/Model/ClassState.md new file mode 100644 index 0000000..f6421a1 --- /dev/null +++ b/docs/reference/Model/ClassState.md @@ -0,0 +1,8 @@ +# ClassState + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ClassUpdate.md b/docs/reference/Model/ClassUpdate.md new file mode 100644 index 0000000..baacaaf --- /dev/null +++ b/docs/reference/Model/ClassUpdate.md @@ -0,0 +1,13 @@ +# ClassUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | The name of the class | [optional] +**section** | **string** | The section of the class | [optional] +**level** | [**\Flat\APIClient\Model\ClassGradeLevel**](ClassGradeLevel.md) | | [optional] +**skills_focused** | **string[]** | Specific skills that will be focused in classroom | [optional] +**size** | **float** | Number of students in the classroom | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/Collection.md b/docs/reference/Model/Collection.md new file mode 100644 index 0000000..45b27b4 --- /dev/null +++ b/docs/reference/Model/Collection.md @@ -0,0 +1,26 @@ +# Collection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of the collection | +**title** | **string** | The title of the collection | +**html_url** | **string** | The url where the collection can be viewed in a web browser | +**type** | [**\Flat\APIClient\Model\CollectionType**](CollectionType.md) | | +**label_key** | **string** | Product-specific translation key for the collection type. Only set for specific collection types: * For `regular` type: `playlist` (Flat) or `collection` (Flat for Education) * For `collaborations` type: `collaboration` (Flat) or `shared-scores` (Flat for Education) Not set for other collection types. | [optional] +**privacy** | [**\Flat\APIClient\Model\CollectionPrivacy**](CollectionPrivacy.md) | | +**sharing_key** | **string** | The private sharing key of the collection (available when the `privacy` mode is set to `privateLink`) | [optional] +**app** | [**\Flat\APIClient\Model\CollectionApp**](CollectionApp.md) | | [optional] +**creation_date** | **\DateTime** | The date when the collection was created | +**modification_date** | **\DateTime** | The date when the collection was last modified | [optional] +**user** | [**\Flat\APIClient\Model\UserPublicSummary**](UserPublicSummary.md) | | [optional] +**organization** | **string** | If the score has been created in an organization, the identifier of this organization. | [optional] +**rights** | [**\Flat\APIClient\Model\ResourceRights**](ResourceRights.md) | | [optional] +**collaborators** | [**\Flat\APIClient\Model\ResourceCollaborator[]**](ResourceCollaborator.md) | The list of the collaborators of the collection | [optional] +**is_pinned** | **bool** | Whether the collection is pinned by the owner | [optional] +**contents** | [**\Flat\APIClient\Model\CollectionContents**](CollectionContents.md) | | +**capabilities** | [**\Flat\APIClient\Model\CollectionCapabilities**](CollectionCapabilities.md) | | +**collections** | **string[]** | The List of parent collections, which includes all the collections this score is included. Please note that you might not have access to all of them. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/CollectionApp.md b/docs/reference/Model/CollectionApp.md new file mode 100644 index 0000000..cace6da --- /dev/null +++ b/docs/reference/Model/CollectionApp.md @@ -0,0 +1,11 @@ +# CollectionApp + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The app unique identifier | [optional] +**name** | **string** | The name of the app | [optional] +**logo** | **string** | The app logo url | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/CollectionCapabilities.md b/docs/reference/Model/CollectionCapabilities.md new file mode 100644 index 0000000..bdd37bb --- /dev/null +++ b/docs/reference/Model/CollectionCapabilities.md @@ -0,0 +1,13 @@ +# CollectionCapabilities + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**can_edit** | **bool** | Whether the current user can modify the metadata for the collection | +**can_share** | **bool** | Whether the current user can modify the sharing settings for the collection | +**can_delete** | **bool** | Whether the current user can delete the collection | +**can_add_scores** | **bool** | Whether the current user can add scores to the collection If this collection has the `type` `trash`, this property will be set to `false`. Use `DELETE /v2/scores/{score}` to trash a score. | +**can_delete_scores** | **bool** | Whether the current user can delete scores from the collection If this collection has the `type` `trash`, this property will be set to `false`. Use `POST /v2/scores/{score}/untrash` to restore a score. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/CollectionContents.md b/docs/reference/Model/CollectionContents.md new file mode 100644 index 0000000..edd12b7 --- /dev/null +++ b/docs/reference/Model/CollectionContents.md @@ -0,0 +1,9 @@ +# CollectionContents + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**scores_count** | **int** | The number of scores in the collection | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/CollectionCreation.md b/docs/reference/Model/CollectionCreation.md new file mode 100644 index 0000000..f2bf3db --- /dev/null +++ b/docs/reference/Model/CollectionCreation.md @@ -0,0 +1,10 @@ +# CollectionCreation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | The title of the collection | [optional] +**privacy** | [**\Flat\APIClient\Model\CollectionPrivacy**](CollectionPrivacy.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/CollectionModification.md b/docs/reference/Model/CollectionModification.md new file mode 100644 index 0000000..29fd050 --- /dev/null +++ b/docs/reference/Model/CollectionModification.md @@ -0,0 +1,10 @@ +# CollectionModification + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | The title of the collection | [optional] +**privacy** | [**\Flat\APIClient\Model\CollectionPrivacy**](CollectionPrivacy.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/CollectionPrivacy.md b/docs/reference/Model/CollectionPrivacy.md new file mode 100644 index 0000000..5213d89 --- /dev/null +++ b/docs/reference/Model/CollectionPrivacy.md @@ -0,0 +1,8 @@ +# CollectionPrivacy + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/CollectionType.md b/docs/reference/Model/CollectionType.md new file mode 100644 index 0000000..4332385 --- /dev/null +++ b/docs/reference/Model/CollectionType.md @@ -0,0 +1,8 @@ +# CollectionType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/CreditTransaction.md b/docs/reference/Model/CreditTransaction.md new file mode 100644 index 0000000..8db241f --- /dev/null +++ b/docs/reference/Model/CreditTransaction.md @@ -0,0 +1,17 @@ +# CreditTransaction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of the credit transaction | +**type** | **string** | Credit category. `ai` covers every AI-powered feature. | +**feature** | **string** | Which product the credits relate to. Set on deductions and on the credits a refund returns, absent on credit-pack top-ups, which are not tied to a single feature. | [optional] +**amount** | **int** | How many credits this entry moved, signed: positive for top-ups (`+30` from a credit pack), negative for deductions (`-2` for a two-page import). Sum only entries whose `state` is `active`. | +**source** | **string** | Which pool the credits came from: * `subscription`: the plan's periodic allowance * `purchase`: credits bought as a pack, which do not expire with the billing period * `free_tier`: promotional grants * `support`: a manual adjustment made by Flat's support team A single import can produce two entries when it spans two pools: the plan allowance is drawn down first, and the remainder comes from `purchase`. | +**state** | **string** | Whether the entry still counts: * `active`: in effect * `canceled`: reversed, and no longer affecting the balance. Deductions are canceled when the import they paid for fails or is refunded. | +**job** | **string** | Identifier of the import this entry belongs to, when it relates to one. Present on an import's deduction, on its reversal, and on credits returned when an import is refunded. Absent on credit-pack top-ups and manual adjustments. | [optional] +**creation_date** | **\DateTime** | When the transaction was created | +**modification_date** | **\DateTime** | When the transaction was last modified | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/EduLibrary.md b/docs/reference/Model/EduLibrary.md new file mode 100644 index 0000000..c6e6fbc --- /dev/null +++ b/docs/reference/Model/EduLibrary.md @@ -0,0 +1,12 @@ +# EduLibrary + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of the library. This one can be used to list the underlying resources using `GET /v2/eduResources?parent={library-id}` | +**name** | **string** | Name of the lirbary | +**type** | **string** | Type of the library | +**visibility** | **string** | Visibility of the library | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/EduResource.md b/docs/reference/Model/EduResource.md new file mode 100644 index 0000000..bdb0058 --- /dev/null +++ b/docs/reference/Model/EduResource.md @@ -0,0 +1,23 @@ +# EduResource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Resource unique identifier | +**creator** | **string** | The User identifier of the resource creator | [optional] +**type** | [**\Flat\APIClient\Model\EduResourceType**](EduResourceType.md) | | +**privacy** | [**\Flat\APIClient\Model\EduResourcePrivacy**](EduResourcePrivacy.md) | | [optional] +**tags** | **string[]** | Specific attributes for the resource (e.g. sample resources with custom design) | [optional] +**parent** | **string** | Identifier of the parent resource, e.g. a folder or root | [optional] +**title** | **string** | Title of the resource | +**sharing_description** | **string** | Sharing description of this resource | [optional] +**sharing_description_html** | **string** | HTML version of sharing description with rich text formatting. Supports safe HTML tags: p, br, strong, b, em, i, u, a. | [optional] +**creation_date** | **\DateTime** | The date when the resource was created | [optional] +**update_date** | **\DateTime** | The date when the resource was updated | [optional] +**resource** | [**\Flat\APIClient\Model\EduResourceResource**](EduResourceResource.md) | | [optional] +**capabilities** | [**\Flat\APIClient\Model\EduResourceCapabilities**](EduResourceCapabilities.md) | | +**subjects** | [**\Flat\APIClient\Model\TeachingTheme[]**](TeachingTheme.md) | The subjects of this resource, or the subjects of the resources included in the folder | [optional] +**grades** | [**\Flat\APIClient\Model\Grade[]**](Grade.md) | The grades of this resource, or the grades of the resources included in the folder. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/EduResourceAssignmentCreation.md b/docs/reference/Model/EduResourceAssignmentCreation.md new file mode 100644 index 0000000..5e5d75f --- /dev/null +++ b/docs/reference/Model/EduResourceAssignmentCreation.md @@ -0,0 +1,9 @@ +# EduResourceAssignmentCreation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**\Flat\APIClient\Model\AssignmentType**](AssignmentType.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/EduResourceCapabilities.md b/docs/reference/Model/EduResourceCapabilities.md new file mode 100644 index 0000000..b1fb545 --- /dev/null +++ b/docs/reference/Model/EduResourceCapabilities.md @@ -0,0 +1,12 @@ +# EduResourceCapabilities + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**can_edit** | **bool** | Whether the current user can modify this resource | [optional] +**can_add_resources** | **bool** | Whether the current user can add resources within this resource (e.g. `assignment` inside a `folder`) | [optional] +**can_add_folders** | **bool** | Whether the current user can add folders within this resource (e.g. `folder` inside `root`) | [optional] +**can_change_privacy** | **bool** | Whether the current user can change the privacy of this resource (e.g. to share as `organizationPublic` or unshare it with `private`) | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/EduResourceCopy.md b/docs/reference/Model/EduResourceCopy.md new file mode 100644 index 0000000..91a1ada --- /dev/null +++ b/docs/reference/Model/EduResourceCopy.md @@ -0,0 +1,9 @@ +# EduResourceCopy + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**destination** | **string** | Unique identifier of the destination of the folder where to copy this resource. This can also be `root` to copy the resource at the root of the user resource library. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/EduResourceCreation.md b/docs/reference/Model/EduResourceCreation.md new file mode 100644 index 0000000..251ab3a --- /dev/null +++ b/docs/reference/Model/EduResourceCreation.md @@ -0,0 +1,14 @@ +# EduResourceCreation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**\Flat\APIClient\Model\EduResourceType**](EduResourceType.md) | | +**title** | **string** | Title of the resource | +**parent** | **string** | Identifier of the parent resource where the new one will created, e.g. a folder id or `root` | [optional] [default to 'root'] +**sharing_description** | **string** | Sharing description of the resource | [optional] +**sharing_description_html** | **string** | HTML version of sharing description with rich text formatting. Supports safe HTML tags: p, br, strong, b, em, i, u, a. | [optional] +**resource** | [**\Flat\APIClient\Model\EduResourceAssignmentCreation**](EduResourceAssignmentCreation.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/EduResourceFolder.md b/docs/reference/Model/EduResourceFolder.md new file mode 100644 index 0000000..50b10a6 --- /dev/null +++ b/docs/reference/Model/EduResourceFolder.md @@ -0,0 +1,11 @@ +# EduResourceFolder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | Title of the folder | [optional] +**assignments_types** | [**\Flat\APIClient\Model\AssignmentType[]**](AssignmentType.md) | The assignment type of the resources that are included in the folder, | [optional] +**resources_count** | **float** | The number of resources inside the folder | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/EduResourceLtiLink.md b/docs/reference/Model/EduResourceLtiLink.md new file mode 100644 index 0000000..8e14009 --- /dev/null +++ b/docs/reference/Model/EduResourceLtiLink.md @@ -0,0 +1,9 @@ +# EduResourceLtiLink + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**lti_url** | **string** | An URL that can be used to launch LTI with this resource in a classroom. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/EduResourceMove.md b/docs/reference/Model/EduResourceMove.md new file mode 100644 index 0000000..e62f9d3 --- /dev/null +++ b/docs/reference/Model/EduResourceMove.md @@ -0,0 +1,9 @@ +# EduResourceMove + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**destination** | **string** | Unique identifier of the destination of the folder where to move this resource. This can also be `root` to move the resource at the root of the user resource library. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/EduResourcePrivacy.md b/docs/reference/Model/EduResourcePrivacy.md new file mode 100644 index 0000000..b38242c --- /dev/null +++ b/docs/reference/Model/EduResourcePrivacy.md @@ -0,0 +1,8 @@ +# EduResourcePrivacy + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/EduResourceResource.md b/docs/reference/Model/EduResourceResource.md new file mode 100644 index 0000000..82abeb1 --- /dev/null +++ b/docs/reference/Model/EduResourceResource.md @@ -0,0 +1,11 @@ +# EduResourceResource + +This model is a `oneOf` wrapper: a value is exactly one of the member types listed below. +It is never instantiated directly — use one of the concrete types. + +## oneOf + +- [**\Flat\APIClient\Model\Assignment**](Assignment.md) +- [**\Flat\APIClient\Model\EduResourceFolder**](EduResourceFolder.md) + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/EduResourceType.md b/docs/reference/Model/EduResourceType.md new file mode 100644 index 0000000..9a3cfc3 --- /dev/null +++ b/docs/reference/Model/EduResourceType.md @@ -0,0 +1,8 @@ +# EduResourceType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/EduResourceUpdate.md b/docs/reference/Model/EduResourceUpdate.md new file mode 100644 index 0000000..c2fa35c --- /dev/null +++ b/docs/reference/Model/EduResourceUpdate.md @@ -0,0 +1,14 @@ +# EduResourceUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | Title of the resource | [optional] +**sharing_description** | **string** | Sharing description of the resource | [optional] +**sharing_description_html** | **string** | HTML version of sharing description with rich text formatting. Supports safe HTML tags: p, br, strong, b, em, i, u, a. | [optional] +**privacy** | [**\Flat\APIClient\Model\EduResourcePrivacy**](EduResourcePrivacy.md) | | [optional] +**subjects** | [**\Flat\APIClient\Model\TeachingTheme[]**](TeachingTheme.md) | The subjects of this resource, or the subjects of the resources included in the folder | [optional] +**grades** | [**\Flat\APIClient\Model\Grade[]**](Grade.md) | The grades of this resource, or the grades of the resources included in the folder. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/EduResourceUseInClass.md b/docs/reference/Model/EduResourceUseInClass.md new file mode 100644 index 0000000..a7c732a --- /dev/null +++ b/docs/reference/Model/EduResourceUseInClass.md @@ -0,0 +1,10 @@ +# EduResourceUseInClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**classroom** | **string** | The destination classroom where the resource will be copied. | +**assignment** | **string** | An optional destination assignment where the original assignement will be copied. Must be a draft. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/FlatErrorResponse.md b/docs/reference/Model/FlatErrorResponse.md new file mode 100644 index 0000000..ea8e8c9 --- /dev/null +++ b/docs/reference/Model/FlatErrorResponse.md @@ -0,0 +1,13 @@ +# FlatErrorResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **string** | A corresponding code for this error | +**message** | **string** | A printable message for this error | +**id** | **string** | An unique error identifier generated for the request | [optional] +**param** | **string** | The related parameter that caused the error | [optional] +**provider_message** | **string** | The untranslated error message returned by an external provider (e.g. Google Classroom), when the error originates from one. Only set on errors forwarded from a third party. Meant for support and IT: display it alongside `message`, never in place of it. `message` is the localized, user-facing text; this field is raw provider output and is always in English. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/GoogleClassroomCoursework.md b/docs/reference/Model/GoogleClassroomCoursework.md new file mode 100644 index 0000000..cd92ca1 --- /dev/null +++ b/docs/reference/Model/GoogleClassroomCoursework.md @@ -0,0 +1,12 @@ +# GoogleClassroomCoursework + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Identifier of the coursework assigned by Classroom | [optional] +**state** | **string** | State of the coursework | [optional] +**alternate_link** | **string** | Absolute link to this coursework in the Classroom web UI | [optional] +**topic_id** | **string** | Identifier of the topic where the assignment is created | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/GoogleClassroomSubmission.md b/docs/reference/Model/GoogleClassroomSubmission.md new file mode 100644 index 0000000..c6830c1 --- /dev/null +++ b/docs/reference/Model/GoogleClassroomSubmission.md @@ -0,0 +1,11 @@ +# GoogleClassroomSubmission + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Identifier of the coursework submission assigned by Classroom | +**state** | **string** | State of the submission on Google Classroom | +**alternate_link** | **string** | Absolute link to this coursework in the Classroom web UI | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/Grade.md b/docs/reference/Model/Grade.md new file mode 100644 index 0000000..cfcef70 --- /dev/null +++ b/docs/reference/Model/Grade.md @@ -0,0 +1,8 @@ +# Grade + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/Group.md b/docs/reference/Model/Group.md new file mode 100644 index 0000000..ac81b0c --- /dev/null +++ b/docs/reference/Model/Group.md @@ -0,0 +1,15 @@ +# Group + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The unique identifier of the group | [optional] +**name** | **string** | The display name of the group | [optional] +**type** | [**\Flat\APIClient\Model\GroupType**](GroupType.md) | | [optional] +**users_count** | **float** | The number of users in this group | [optional] +**read_only** | **bool** | `True` if the group is set in read-only | [optional] +**organization** | **string** | If the group is related to an organization, this field will contain the unique identifier of the organization | [optional] +**creation_date** | **\DateTime** | The creation date of the group | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/GroupCreation.md b/docs/reference/Model/GroupCreation.md new file mode 100644 index 0000000..1628856 --- /dev/null +++ b/docs/reference/Model/GroupCreation.md @@ -0,0 +1,12 @@ +# GroupCreation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | Type of group (currently only classStudentsSubGroup is supported) | +**classroom** | **string** | Classroom ID | +**name** | **string** | Name of the group (optional - auto-generated if not provided). **Special names:** * `edu:testing-students`: Creates a group tagged for test student accounts. The display name will be localized (e.g., \"Test Students\") and the group will be tagged with `edu:testing-students`. | [optional] +**members** | **string[]** | Array of student IDs to add to the group | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/GroupDetails.md b/docs/reference/Model/GroupDetails.md new file mode 100644 index 0000000..6fc0258 --- /dev/null +++ b/docs/reference/Model/GroupDetails.md @@ -0,0 +1,19 @@ +# GroupDetails + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The unique identifier of the group | +**name** | **string** | The displayable name of the group | +**type** | [**\Flat\APIClient\Model\GroupType**](GroupType.md) | | +**organization** | **string** | The unique identifier of the Organization owning the group | [optional] +**classroom** | **string** | The unique identifier of the classroom owning the group. Only available for groups of type 'classromStudentsSubGroup' or 'assignmentStudentsSubGroup' | [optional] +**assignment** | **string** | The unique identifier of the assignment owning the group. Only available for groups of type 'assignmentStudentsSubGroup'. | [optional] +**parent** | **string** | The unique identifier of the parent class group. Only available for groups of type 'assignmentStudentsSubGroup'. May be null if the parent class group was deleted. | [optional] +**creation_date** | **\DateTime** | The date when the group was create | +**users_count** | **float** | The number of students in this group | +**read_only** | **bool** | `true` if the properties and members of this group are in in read-only | +**tags** | **string[]** | Tags for categorizing groups. * `edu:testing-students`: Marks this group as containing test student accounts | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/GroupType.md b/docs/reference/Model/GroupType.md new file mode 100644 index 0000000..4c883b2 --- /dev/null +++ b/docs/reference/Model/GroupType.md @@ -0,0 +1,8 @@ +# GroupType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LicenseMode.md b/docs/reference/Model/LicenseMode.md new file mode 100644 index 0000000..f21b987 --- /dev/null +++ b/docs/reference/Model/LicenseMode.md @@ -0,0 +1,8 @@ +# LicenseMode + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LicenseSources.md b/docs/reference/Model/LicenseSources.md new file mode 100644 index 0000000..d97de72 --- /dev/null +++ b/docs/reference/Model/LicenseSources.md @@ -0,0 +1,8 @@ +# LicenseSources + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LmsName.md b/docs/reference/Model/LmsName.md new file mode 100644 index 0000000..695f1d8 --- /dev/null +++ b/docs/reference/Model/LmsName.md @@ -0,0 +1,8 @@ +# LmsName + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiConfiguration.md b/docs/reference/Model/LtiConfiguration.md new file mode 100644 index 0000000..52d8775 --- /dev/null +++ b/docs/reference/Model/LtiConfiguration.md @@ -0,0 +1,13 @@ +# LtiConfiguration + +This model is a `oneOf` wrapper: a value is exactly one of the member types listed below. +It is never instantiated directly — use one of the concrete types. + +## oneOf + +- [**\Flat\APIClient\Model\LtiConfiguration1p1**](LtiConfiguration1p1.md) +- [**\Flat\APIClient\Model\LtiConfiguration1p3**](LtiConfiguration1p3.md) + +The concrete type is selected by the `lti_version` discriminator property. + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiConfiguration1p1.md b/docs/reference/Model/LtiConfiguration1p1.md new file mode 100644 index 0000000..4146156 --- /dev/null +++ b/docs/reference/Model/LtiConfiguration1p1.md @@ -0,0 +1,21 @@ +# LtiConfiguration1p1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Configuration ID | +**lti_version** | **string** | LTI version (1.1) | +**organization_id** | **string** | Organization ID | [optional] +**organization_name** | **string** | Organization name | [optional] +**creator_id** | **string** | ID of the user who created this configuration | [optional] +**creation_date** | **\DateTime** | Configuration creation date | +**last_used_date** | **\DateTime** | Last time this configuration was used | [optional] +**status** | **string** | Configuration status indicator | [optional] +**consumer_key** | **string** | LTI 1.1 consumer key | [optional] +**consumer_secret** | **string** | LTI 1.1 consumer secret (only included for admins) | [optional] +**lms** | **string** | LMS type | [optional] +**name** | **string** | Configuration name | [optional] +**tool** | [**\Flat\APIClient\Model\LtiConfiguration1p1AllOfTool**](LtiConfiguration1p1AllOfTool.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiConfiguration1p1AllOfTool.md b/docs/reference/Model/LtiConfiguration1p1AllOfTool.md new file mode 100644 index 0000000..69ec248 --- /dev/null +++ b/docs/reference/Model/LtiConfiguration1p1AllOfTool.md @@ -0,0 +1,14 @@ +# LtiConfiguration1p1AllOfTool + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**product** | **string** | Product family code (e.g., canvas, moodle, schoology) | [optional] +**version** | **string** | Platform version string | [optional] +**instance_name** | **string** | Instance display name | [optional] +**instance_guid** | **string** | Unique instance identifier | [optional] +**instance_contact** | **string** | Contact email or handle for the instance | [optional] +**instance_domain** | **string** | Instance root domain | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiConfiguration1p3.md b/docs/reference/Model/LtiConfiguration1p3.md new file mode 100644 index 0000000..ab9f811 --- /dev/null +++ b/docs/reference/Model/LtiConfiguration1p3.md @@ -0,0 +1,12 @@ +# LtiConfiguration1p3 + +This model is a `oneOf` wrapper: a value is exactly one of the member types listed below. +It is never instantiated directly — use one of the concrete types. + +## oneOf + +- [**\Flat\APIClient\Model\LtiConfiguration1p3Manual**](LtiConfiguration1p3Manual.md) +- [**\Flat\APIClient\Model\LtiConfiguration1p3Deployment**](LtiConfiguration1p3Deployment.md) +- [**\Flat\APIClient\Model\LtiConfiguration1p3Dynamic**](LtiConfiguration1p3Dynamic.md) + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiConfiguration1p3Base.md b/docs/reference/Model/LtiConfiguration1p3Base.md new file mode 100644 index 0000000..7da77fe --- /dev/null +++ b/docs/reference/Model/LtiConfiguration1p3Base.md @@ -0,0 +1,23 @@ +# LtiConfiguration1p3Base + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mode** | **string** | LTI 1.3 configuration mode | [optional] +**platform_iss** | **string** | Platform issuer URL | [optional] +**platform_name** | **string** | Platform display name | [optional] +**client_id** | **string** | OAuth2 client_id allocated by the platform | [optional] +**deployment_id** | **string** | Deployment ID linking the tool to a tenant/class (varies by platform) | [optional] +**access_token_url** | **string** | OAuth2 token endpoint (for AGS/NRPS) | [optional] +**authorization_url** | **string** | OIDC authorization/login endpoint | [optional] +**jwks_url** | **string** | Platform JWKS endpoint (public keys) | [optional] +**deployment_mode** | **string** | Deployment mode (single for organization-specific, multi for shared parent platforms) | [optional] +**supported_services** | [**\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices**](LtiConfiguration1p3BaseSupportedServices.md) | | [optional] +**tool** | [**\Flat\APIClient\Model\LtiConfiguration1p3BaseTool**](LtiConfiguration1p3BaseTool.md) | | [optional] +**public_keyset_url** | **string** | Public keyset URL for the platform to retrieve Flat's public keys | [optional] +**initiate_login_url** | **string** | URL for the platform to initiate LTI login | [optional] +**redirect_uris** | **string[]** | Allowed redirect URIs for LTI launches | [optional] +**enable_email_matching** | **bool** | Enable email-based user matching during LTI authentication. When true (default): If a user with the same email exists in the organization, they will be matched and logged in instead of creating a new account. When false: Email matching is disabled. Only LTI ID matching is used, which means multiple LTI users can share the same email address and have separate Flat accounts. This is useful for cases like siblings sharing a parent email in the LMS. | [optional] [default to true] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiConfiguration1p3BaseSupportedServices.md b/docs/reference/Model/LtiConfiguration1p3BaseSupportedServices.md new file mode 100644 index 0000000..a68c4e9 --- /dev/null +++ b/docs/reference/Model/LtiConfiguration1p3BaseSupportedServices.md @@ -0,0 +1,11 @@ +# LtiConfiguration1p3BaseSupportedServices + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ags** | [**\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServicesAgs**](LtiConfiguration1p3BaseSupportedServicesAgs.md) | | [optional] +**nrps** | [**\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServicesNrps**](LtiConfiguration1p3BaseSupportedServicesNrps.md) | | [optional] +**deep_linking** | [**\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServicesDeepLinking**](LtiConfiguration1p3BaseSupportedServicesDeepLinking.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiConfiguration1p3BaseSupportedServicesAgs.md b/docs/reference/Model/LtiConfiguration1p3BaseSupportedServicesAgs.md new file mode 100644 index 0000000..baf1ac3 --- /dev/null +++ b/docs/reference/Model/LtiConfiguration1p3BaseSupportedServicesAgs.md @@ -0,0 +1,12 @@ +# LtiConfiguration1p3BaseSupportedServicesAgs + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**available** | **bool** | Whether AGS claims were detected in launches from this platform | [optional] +**version** | **string** | AGS version supported (e.g., \"2.0\") | [optional] +**enabled** | **bool** | Whether we have AGS enabled for this platform | [optional] +**lineitems_url** | **string** | Base URL for line items operations as provided by the platform | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiConfiguration1p3BaseSupportedServicesDeepLinking.md b/docs/reference/Model/LtiConfiguration1p3BaseSupportedServicesDeepLinking.md new file mode 100644 index 0000000..cf97cbf --- /dev/null +++ b/docs/reference/Model/LtiConfiguration1p3BaseSupportedServicesDeepLinking.md @@ -0,0 +1,10 @@ +# LtiConfiguration1p3BaseSupportedServicesDeepLinking + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**available** | **bool** | Whether Deep Linking claims were detected in launches from this platform | [optional] +**version** | **string** | Deep Linking version supported (e.g., \"2.0\") | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiConfiguration1p3BaseSupportedServicesNrps.md b/docs/reference/Model/LtiConfiguration1p3BaseSupportedServicesNrps.md new file mode 100644 index 0000000..765092a --- /dev/null +++ b/docs/reference/Model/LtiConfiguration1p3BaseSupportedServicesNrps.md @@ -0,0 +1,11 @@ +# LtiConfiguration1p3BaseSupportedServicesNrps + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**available** | **bool** | Whether NRPS claims were detected in launches from this platform | [optional] +**version** | **string** | NRPS version supported (e.g., \"2.0\") | [optional] +**enabled** | **bool** | Whether we have NRPS enabled for this platform | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiConfiguration1p3BaseTool.md b/docs/reference/Model/LtiConfiguration1p3BaseTool.md new file mode 100644 index 0000000..d0a73b5 --- /dev/null +++ b/docs/reference/Model/LtiConfiguration1p3BaseTool.md @@ -0,0 +1,14 @@ +# LtiConfiguration1p3BaseTool + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**product** | **string** | Product family code (e.g., canvas, moodle, schoology) | [optional] +**version** | **string** | Platform version string | [optional] +**instance_name** | **string** | Instance name (e.g., 'My University Canvas') | [optional] +**instance_guid** | **string** | Unique instance identifier | [optional] +**instance_contact** | **string** | Contact email or handle for the instance | [optional] +**instance_domain** | **string** | Instance root domain | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiConfiguration1p3Deployment.md b/docs/reference/Model/LtiConfiguration1p3Deployment.md new file mode 100644 index 0000000..7603e5a --- /dev/null +++ b/docs/reference/Model/LtiConfiguration1p3Deployment.md @@ -0,0 +1,35 @@ +# LtiConfiguration1p3Deployment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Configuration ID | +**lti_version** | **string** | LTI version (1.3) | +**organization_id** | **string** | Organization ID | [optional] +**organization_name** | **string** | Organization name | [optional] +**creator_id** | **string** | ID of the user who created this configuration | [optional] +**creation_date** | **\DateTime** | Configuration creation date | +**last_used_date** | **\DateTime** | Last time this configuration was used | [optional] +**status** | **string** | Configuration status indicator | [optional] +**mode** | **string** | Deployment-based LTI 1.3 configuration mode | [optional] +**platform_iss** | **string** | Platform issuer URL | [optional] +**platform_name** | **string** | Platform display name | [optional] +**client_id** | **string** | OAuth2 client_id allocated by the platform | [optional] +**deployment_id** | **string** | Deployment ID linking the tool to a tenant/class (varies by platform) | [optional] +**access_token_url** | **string** | OAuth2 token endpoint (for AGS/NRPS) | [optional] +**authorization_url** | **string** | OIDC authorization/login endpoint | [optional] +**jwks_url** | **string** | Platform JWKS endpoint (public keys) | [optional] +**deployment_mode** | **string** | Deployment mode (single for organization-specific, multi for shared parent platforms) | [optional] +**supported_services** | [**\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices**](LtiConfiguration1p3BaseSupportedServices.md) | | [optional] +**tool** | [**\Flat\APIClient\Model\LtiConfiguration1p3BaseTool**](LtiConfiguration1p3BaseTool.md) | | [optional] +**public_keyset_url** | **string** | Public keyset URL for the platform to retrieve Flat's public keys | [optional] +**initiate_login_url** | **string** | URL for the platform to initiate LTI login | [optional] +**redirect_uris** | **string[]** | Allowed redirect URIs for LTI launches | [optional] +**enable_email_matching** | **bool** | Enable email-based user matching during LTI authentication. When true (default): If a user with the same email exists in the organization, they will be matched and logged in instead of creating a new account. When false: Email matching is disabled. Only LTI ID matching is used, which means multiple LTI users can share the same email address and have separate Flat accounts. This is useful for cases like siblings sharing a parent email in the LMS. | [optional] [default to true] +**parent_id** | **string** | Parent configuration ID (for deployment-based configs) | [optional] +**deployment_key** | **string** | Deployment key (e.g., schoology, classlink) | [optional] +**deployment_breakdown_by** | **string** | Custom claim used for tenant identification (parent platforms only, read-only) | [optional] +**deployment_breakdown_id** | **string** | Value of the custom claim that identifies this specific tenant (child platforms only) | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiConfiguration1p3Dynamic.md b/docs/reference/Model/LtiConfiguration1p3Dynamic.md new file mode 100644 index 0000000..a3df500 --- /dev/null +++ b/docs/reference/Model/LtiConfiguration1p3Dynamic.md @@ -0,0 +1,35 @@ +# LtiConfiguration1p3Dynamic + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Configuration ID | +**lti_version** | **string** | LTI version (1.3) | +**organization_id** | **string** | Organization ID | [optional] +**organization_name** | **string** | Organization name | [optional] +**creator_id** | **string** | ID of the user who created this configuration | [optional] +**creation_date** | **\DateTime** | Configuration creation date | +**last_used_date** | **\DateTime** | Last time this configuration was used | [optional] +**status** | **string** | Configuration status indicator | [optional] +**mode** | **string** | Dynamic registration LTI 1.3 configuration mode | [optional] +**platform_iss** | **string** | Platform issuer URL | [optional] +**platform_name** | **string** | Platform display name | [optional] +**client_id** | **string** | OAuth2 client_id allocated by the platform | [optional] +**deployment_id** | **string** | Deployment ID linking the tool to a tenant/class (varies by platform) | [optional] +**access_token_url** | **string** | OAuth2 token endpoint (for AGS/NRPS) | [optional] +**authorization_url** | **string** | OIDC authorization/login endpoint | [optional] +**jwks_url** | **string** | Platform JWKS endpoint (public keys) | [optional] +**deployment_mode** | **string** | Deployment mode (single for organization-specific, multi for shared parent platforms) | [optional] +**supported_services** | [**\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices**](LtiConfiguration1p3BaseSupportedServices.md) | | [optional] +**tool** | [**\Flat\APIClient\Model\LtiConfiguration1p3BaseTool**](LtiConfiguration1p3BaseTool.md) | | [optional] +**public_keyset_url** | **string** | Public keyset URL for the platform to retrieve Flat's public keys | [optional] +**initiate_login_url** | **string** | URL for the platform to initiate LTI login | [optional] +**redirect_uris** | **string[]** | Allowed redirect URIs for LTI launches | [optional] +**enable_email_matching** | **bool** | Enable email-based user matching during LTI authentication. When true (default): If a user with the same email exists in the organization, they will be matched and logged in instead of creating a new account. When false: Email matching is disabled. Only LTI ID matching is used, which means multiple LTI users can share the same email address and have separate Flat accounts. This is useful for cases like siblings sharing a parent email in the LMS. | [optional] [default to true] +**registration_token** | **string** | Only included for admins | [optional] +**registration_url** | **string** | Dynamic registration URL (only included for admins when available) | [optional] +**registration_token_used** | **bool** | Whether dynamic registration token has been used | [optional] +**registration_completion_date** | **\DateTime** | Date when dynamic registration completed (null when not completed) | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiConfiguration1p3Manual.md b/docs/reference/Model/LtiConfiguration1p3Manual.md new file mode 100644 index 0000000..c77aca1 --- /dev/null +++ b/docs/reference/Model/LtiConfiguration1p3Manual.md @@ -0,0 +1,31 @@ +# LtiConfiguration1p3Manual + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Configuration ID | +**lti_version** | **string** | LTI version (1.3) | +**organization_id** | **string** | Organization ID | [optional] +**organization_name** | **string** | Organization name | [optional] +**creator_id** | **string** | ID of the user who created this configuration | [optional] +**creation_date** | **\DateTime** | Configuration creation date | +**last_used_date** | **\DateTime** | Last time this configuration was used | [optional] +**status** | **string** | Configuration status indicator | [optional] +**mode** | **string** | Manual LTI 1.3 configuration mode | [optional] +**platform_iss** | **string** | Platform issuer URL | [optional] +**platform_name** | **string** | Platform display name | [optional] +**client_id** | **string** | OAuth2 client_id allocated by the platform | [optional] +**deployment_id** | **string** | Deployment ID linking the tool to a tenant/class (varies by platform) | [optional] +**access_token_url** | **string** | OAuth2 token endpoint (for AGS/NRPS) | [optional] +**authorization_url** | **string** | OIDC authorization/login endpoint | [optional] +**jwks_url** | **string** | Platform JWKS endpoint (public keys) | [optional] +**deployment_mode** | **string** | Deployment mode (single for organization-specific, multi for shared parent platforms) | [optional] +**supported_services** | [**\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices**](LtiConfiguration1p3BaseSupportedServices.md) | | [optional] +**tool** | [**\Flat\APIClient\Model\LtiConfiguration1p3BaseTool**](LtiConfiguration1p3BaseTool.md) | | [optional] +**public_keyset_url** | **string** | Public keyset URL for the platform to retrieve Flat's public keys | [optional] +**initiate_login_url** | **string** | URL for the platform to initiate LTI login | [optional] +**redirect_uris** | **string[]** | Allowed redirect URIs for LTI launches | [optional] +**enable_email_matching** | **bool** | Enable email-based user matching during LTI authentication. When true (default): If a user with the same email exists in the organization, they will be matched and logged in instead of creating a new account. When false: Email matching is disabled. Only LTI ID matching is used, which means multiple LTI users can share the same email address and have separate Flat accounts. This is useful for cases like siblings sharing a parent email in the LMS. | [optional] [default to true] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiConfigurationBase.md b/docs/reference/Model/LtiConfigurationBase.md new file mode 100644 index 0000000..2ab77ca --- /dev/null +++ b/docs/reference/Model/LtiConfigurationBase.md @@ -0,0 +1,16 @@ +# LtiConfigurationBase + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Configuration ID | +**lti_version** | **string** | LTI version | +**organization_id** | **string** | Organization ID | [optional] +**organization_name** | **string** | Organization name | [optional] +**creator_id** | **string** | ID of the user who created this configuration | [optional] +**creation_date** | **\DateTime** | Configuration creation date | +**last_used_date** | **\DateTime** | Last time this configuration was used | [optional] +**status** | **string** | Configuration status indicator | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiConfigurationCreate.md b/docs/reference/Model/LtiConfigurationCreate.md new file mode 100644 index 0000000..a3c8fc3 --- /dev/null +++ b/docs/reference/Model/LtiConfigurationCreate.md @@ -0,0 +1,15 @@ +# LtiConfigurationCreate + +This model is a `oneOf` wrapper: a value is exactly one of the member types listed below. +It is never instantiated directly — use one of the concrete types. + +## oneOf + +- [**\Flat\APIClient\Model\LtiConfigurationCreate1p1**](LtiConfigurationCreate1p1.md) +- [**\Flat\APIClient\Model\LtiConfigurationCreate1p3Dynamic**](LtiConfigurationCreate1p3Dynamic.md) +- [**\Flat\APIClient\Model\LtiConfigurationCreate1p3Deployment**](LtiConfigurationCreate1p3Deployment.md) +- [**\Flat\APIClient\Model\LtiConfigurationCreate1p3Manual**](LtiConfigurationCreate1p3Manual.md) + +The concrete type is selected by the `mode` discriminator property. + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiConfigurationCreate1p1.md b/docs/reference/Model/LtiConfigurationCreate1p1.md new file mode 100644 index 0000000..966a84f --- /dev/null +++ b/docs/reference/Model/LtiConfigurationCreate1p1.md @@ -0,0 +1,11 @@ +# LtiConfigurationCreate1p1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mode** | **string** | LTI 1.1 manual creation mode | +**name** | **string** | Display name for LTI 1.1 credentials | [optional] +**lms** | **string** | LMS identifier for LTI 1.1 credentials | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiConfigurationCreate1p3Deployment.md b/docs/reference/Model/LtiConfigurationCreate1p3Deployment.md new file mode 100644 index 0000000..e5b9ed7 --- /dev/null +++ b/docs/reference/Model/LtiConfigurationCreate1p3Deployment.md @@ -0,0 +1,13 @@ +# LtiConfigurationCreate1p3Deployment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mode** | **string** | LTI 1.3 deployment-based creation mode | +**deployment_type** | **string** | Parent platform key (e.g., canvas, blackboard, schoology, classlink) | +**deployment_id** | **string** | Deployment identifier provided by the platform | +**client_id** | **string** | OAuth2 client_id for the tenant; required for ClassLink deployments | [optional] +**deployment_breakdown_id** | **string** | Value of the custom claim that identifies this specific tenant (for multi-tenant platforms like Schoology) | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiConfigurationCreate1p3Dynamic.md b/docs/reference/Model/LtiConfigurationCreate1p3Dynamic.md new file mode 100644 index 0000000..0ac4f4d --- /dev/null +++ b/docs/reference/Model/LtiConfigurationCreate1p3Dynamic.md @@ -0,0 +1,11 @@ +# LtiConfigurationCreate1p3Dynamic + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mode** | **string** | LTI 1.3 dynamic registration mode | +**platform_info** | [**\Flat\APIClient\Model\LtiConfigurationCreate1p3DynamicPlatformInfo**](LtiConfigurationCreate1p3DynamicPlatformInfo.md) | | [optional] +**locale** | **string** | Optional locale code for registration URL. Input values will be automatically normalized to a supported locale code. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiConfigurationCreate1p3DynamicPlatformInfo.md b/docs/reference/Model/LtiConfigurationCreate1p3DynamicPlatformInfo.md new file mode 100644 index 0000000..8c99374 --- /dev/null +++ b/docs/reference/Model/LtiConfigurationCreate1p3DynamicPlatformInfo.md @@ -0,0 +1,10 @@ +# LtiConfigurationCreate1p3DynamicPlatformInfo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Platform display name | [optional] +**url** | **string** | Optional platform homepage or admin URL for reference | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiConfigurationCreate1p3Manual.md b/docs/reference/Model/LtiConfigurationCreate1p3Manual.md new file mode 100644 index 0000000..909fc03 --- /dev/null +++ b/docs/reference/Model/LtiConfigurationCreate1p3Manual.md @@ -0,0 +1,17 @@ +# LtiConfigurationCreate1p3Manual + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mode** | **string** | LTI 1.3 manual creation mode | +**platform_iss** | **string** | Platform issuer URL | [optional] +**platform_name** | **string** | Platform display name | [optional] +**client_id** | **string** | OAuth2 client_id allocated by the platform | [optional] +**deployment_id** | **string** | Deployment identifier provided by the platform | [optional] +**access_token_url** | **string** | Platform access token endpoint URL | [optional] +**authorization_url** | **string** | Platform OIDC authorization endpoint URL | [optional] +**jwks_url** | **string** | Platform JWKS endpoint URL for public keys | [optional] +**enable_email_matching** | **bool** | Enable email-based user matching during LTI authentication | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiConfigurationUpdate.md b/docs/reference/Model/LtiConfigurationUpdate.md new file mode 100644 index 0000000..d15f829 --- /dev/null +++ b/docs/reference/Model/LtiConfigurationUpdate.md @@ -0,0 +1,17 @@ +# LtiConfigurationUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**deployment_id** | **string** | Deployment identifier provided by the platform | [optional] +**deployment_breakdown_id** | **string** | Specific tenant identifier for multi-tenant platforms | [optional] +**enable_email_matching** | **bool** | Enable email-based user matching during LTI authentication | [optional] +**platform_iss** | **string** | Platform issuer URL | [optional] +**platform_name** | **string** | Platform display name | [optional] +**client_id** | **string** | OAuth2 client_id allocated by the platform | [optional] +**access_token_url** | **string** | Platform access token endpoint URL | [optional] +**authorization_url** | **string** | Platform OIDC authorization endpoint URL | [optional] +**jwks_url** | **string** | Platform JWKS endpoint URL for public keys | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiConfigurationUpdateDeployment.md b/docs/reference/Model/LtiConfigurationUpdateDeployment.md new file mode 100644 index 0000000..2f6820a --- /dev/null +++ b/docs/reference/Model/LtiConfigurationUpdateDeployment.md @@ -0,0 +1,11 @@ +# LtiConfigurationUpdateDeployment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**deployment_id** | **string** | Deployment identifier provided by the platform | [optional] +**deployment_breakdown_id** | **string** | Specific tenant identifier for multi-tenant platforms | [optional] +**enable_email_matching** | **bool** | Enable email-based user matching during LTI authentication | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiConfigurationUpdateStandalone.md b/docs/reference/Model/LtiConfigurationUpdateStandalone.md new file mode 100644 index 0000000..1809ad4 --- /dev/null +++ b/docs/reference/Model/LtiConfigurationUpdateStandalone.md @@ -0,0 +1,16 @@ +# LtiConfigurationUpdateStandalone + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**deployment_id** | **string** | Deployment identifier provided by the platform | [optional] +**platform_iss** | **string** | Platform issuer URL | [optional] +**platform_name** | **string** | Platform display name | [optional] +**client_id** | **string** | OAuth2 client_id allocated by the platform | [optional] +**access_token_url** | **string** | Platform access token endpoint URL | [optional] +**authorization_url** | **string** | Platform OIDC authorization endpoint URL | [optional] +**jwks_url** | **string** | Platform JWKS endpoint URL for public keys | [optional] +**enable_email_matching** | **bool** | Enable email-based user matching during LTI authentication | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiCredentials.md b/docs/reference/Model/LtiCredentials.md new file mode 100644 index 0000000..d670071 --- /dev/null +++ b/docs/reference/Model/LtiCredentials.md @@ -0,0 +1,18 @@ +# LtiCredentials + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The unique identifier of this couple of credentials | [optional] +**name** | **string** | Name of the couple of credentials | [optional] +**lms** | [**\Flat\APIClient\Model\LmsName**](LmsName.md) | | [optional] +**organization** | **string** | The unique identifier of the Organization associated to these credentials | [optional] +**creator** | **string** | Unique identifier of the user who created these credentials | [optional] +**creation_date** | **\DateTime** | The creation date of thse credentials | [optional] +**last_usage** | **\DateTime** | The last time these credentials were used | [optional] +**consumer_key** | **string** | OAuth 1 Consumer Key | [optional] +**consumer_secret** | **string** | OAuth 1 Consumer Secret | [optional] +**enable_email_matching** | **bool** | Enable email-based user matching during LTI authentication. When true (default): If a user with the same email exists in the organization, they will be matched and logged in instead of creating a new account. When false: Email matching is disabled. Only LTI ID matching is used, which means multiple LTI users can share the same email address and have separate Flat accounts. This is useful for cases like siblings sharing a parent email in the LMS. | [optional] [default to true] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/LtiCredentialsCreation.md b/docs/reference/Model/LtiCredentialsCreation.md new file mode 100644 index 0000000..a702465 --- /dev/null +++ b/docs/reference/Model/LtiCredentialsCreation.md @@ -0,0 +1,10 @@ +# LtiCredentialsCreation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of the couple of credentials | +**lms** | [**\Flat\APIClient\Model\LmsName**](LmsName.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/MediaAttachment.md b/docs/reference/Model/MediaAttachment.md new file mode 100644 index 0000000..49a267d --- /dev/null +++ b/docs/reference/Model/MediaAttachment.md @@ -0,0 +1,32 @@ +# MediaAttachment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | The type of the assignment resolved: * `rich`, `photo`, `video` are automatically resolved as `link` * A `flat` attachment is a score document where the unique identifier will be specified in the `score` property. Its sharing mode will be provided in the `sharingMode` property. | +**score** | **string** | An unique Flat score identifier | [optional] +**revision** | **string** | An unique revision identifier of a score | [optional] +**worksheet** | **string** | An unique worksheet identifier | [optional] +**dedicated** | **bool** | True if the resource is dedicated for the assignment (for scores and worksheets), meaning on the user-side this one is stored in the assignment | [optional] +**track** | **string** | A unique track identifier | [optional] +**part_uuid** | **string** | The UUID of the instrument part selected for this attachment (for performance submissions) | [optional] +**sharing_mode** | [**\Flat\APIClient\Model\MediaScoreSharingMode**](MediaScoreSharingMode.md) | | [optional] +**lock_score_template** | **bool** | To be used with a score attached in `sharingMode` `copy` (score used as template). If true, students won't be able to change the original notes of the template. | [optional] +**title** | **string** | The resolved title of the attachment | [optional] +**description** | **string** | The resolved description of the attachment | [optional] +**html** | **string** | If the attachment type is `rich` or `video`, the HTML code of the media to display | [optional] +**html_width** | **float** | If the `html` is available, the width of the widget | [optional] +**html_height** | **float** | If the `html` is available, the height of the widget | [optional] +**url** | **string** | The url of the attachment | [optional] +**thumbnail_url** | **string** | If the attachment type is `rich`, `video`, `photo` or `link`, a displayable thumbnail for this attachment | [optional] +**thumbnail_width** | **int** | If the `thumbnailUrl` is available, the width of the thumbnail | [optional] +**thumbnail_height** | **int** | If the `thumbnailUrl` is available, the width of the thumbnail | [optional] +**author_name** | **string** | The resolved author name of the attachment | [optional] +**author_url** | **string** | The resolved author url of the attachment | [optional] +**icon_url** | **string** | The URL of the icon | [optional] +**mime_type** | **string** | The mine type of the file | [optional] +**google_drive_file_id** | **string** | The ID of the Google Drive File | [optional] +**teacher_only** | **bool** | If true, this attachment is only visible to teachers. When students view the assignment, attachments with this flag will be filtered out. | [optional] [default to false] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/MediaScoreSharingMode.md b/docs/reference/Model/MediaScoreSharingMode.md new file mode 100644 index 0000000..98da702 --- /dev/null +++ b/docs/reference/Model/MediaScoreSharingMode.md @@ -0,0 +1,8 @@ +# MediaScoreSharingMode + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/MicrosoftGraphAssignment.md b/docs/reference/Model/MicrosoftGraphAssignment.md new file mode 100644 index 0000000..b5bac7a --- /dev/null +++ b/docs/reference/Model/MicrosoftGraphAssignment.md @@ -0,0 +1,15 @@ +# MicrosoftGraphAssignment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Identifier of the assignment assigned by Microsoft Teams | [optional] +**state** | **string** | State of the assignment on Microsoft Teams. * `draft`: Assignment is in draft mode * `scheduled`: Assignment is scheduled to be published at a future date * `published`: Assignment has been published to students * `assigned`: Assignment has been assigned (legacy status) * `inactive`: Assignment is inactive | [optional] +**alternate_link** | **string** | Absolute link to this assignment in the Microsoft Teams web UI | [optional] +**assign_date_time** | **\DateTime** | The date when the assignment will become active on Microsoft Teams. If set to a future date, the assignment will have status `scheduled` and won't be visible to students until this date. | [optional] +**categories** | **string[]** | List of categories where this assignment is published under | [optional] +**assign_to_type** | **string** | Recipient configuration for this assignment on Microsoft Teams. * `class`: Assignment is visible to all students in the class * `individual`: Assignment is visible only to specific assigned students | [optional] +**assigned_students_ms_ids** | **string[]** | When assignToType is 'individual', array of Microsoft Azure user IDs of students assigned to this assignment. These are the students who can see and submit to this assignment on Teams. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/MicrosoftGraphSubmission.md b/docs/reference/Model/MicrosoftGraphSubmission.md new file mode 100644 index 0000000..f0d5d9f --- /dev/null +++ b/docs/reference/Model/MicrosoftGraphSubmission.md @@ -0,0 +1,10 @@ +# MicrosoftGraphSubmission + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Identifier of the submission assigned by Microsoft Teams | +**state** | **string** | State of the submission | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OmrCapabilities.md b/docs/reference/Model/OmrCapabilities.md new file mode 100644 index 0000000..5c85c59 --- /dev/null +++ b/docs/reference/Model/OmrCapabilities.md @@ -0,0 +1,22 @@ +# OmrCapabilities + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**steps** | [**\Flat\APIClient\Model\OmrStepName[]**](OmrStepName.md) | Interactive steps this server supports. | +**formats** | **string[]** | Export formats available via `getOmrJobExport`. | +**outputs** | [**\Flat\APIClient\Model\OmrJobOutput[]**](OmrJobOutput.md) | Output destinations the account can use when creating a job. | +**max_files** | **int** | Maximum number of input files that can be added to a single job. | +**max_pages** | **int** | Maximum number of pages allowed across all input files of a single job. | +**max_parallel_jobs** | **int** | Maximum number of OMR jobs that can run in parallel for this account. | +**max_file_size** | **int** | Maximum size of a single file, in bytes. | +**accepted_mime_types** | **string[]** | MIME types accepted for input files: PDF, plus the raster image formats. Drive the file picker from this list rather than hardcoding it, so newly supported formats need no client release. A file is identified by its content, so its declared type and its extension do not have to match. A multi-page input counts as several pages against `maxPages` and is charged accordingly. That covers PDFs and, among the image formats, multi-page TIFF and animated GIF/WebP. | +**accepted_extensions** | **string[]** | Filename extensions the accepted types appear under, for building a file picker. Use these alongside `acceptedMimeTypes` in an `accept` attribute: browsers and native file dialogs filter unreliably on some of the image types, so a valid file can be greyed out when only its MIME type is offered. Longer than `acceptedMimeTypes`, because one type arrives under several extensions (`.jpg` and `.jpeg`, `.tif` and `.tiff`, `.heic` and `.heif`). Picker metadata only. A file is identified by its content, so its extension never decides whether an upload is accepted. | +**cost_per_page** | **int** | Credits charged per page. | [optional] +**remaining_credits** | **int** | OMR credits remaining for the account. | [optional] +**retention_days** | **int** | How many days a `musicxml` job's uploaded files and results are kept before erasure. Reflects the account's own period when one has been set, otherwise the platform default. Read-only: contact support to change it. Jobs with `output: library` are not covered by the retention policy and are unaffected by this value. | [optional] +**locales** | **string[]** | Locales selectable for OCR, as BCP 47 codes sorted alphabetically. These are the locales the recognition pipeline can actually read, which is neither the list of Flat interface locales nor a fixed set: new languages are added over time. Clients should default to the user's own locale when it appears here. | +**locales_details** | [**\Flat\APIClient\Model\OmrLocaleDetails[]**](OmrLocaleDetails.md) | The same locales as `locales`, each with its English display name, sorted alphabetically by `name` and ready to bind to a language picker. Prefer this over `locales` when rendering a selector: it saves clients from shipping their own code-to-label table. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OmrDetailsStepData.md b/docs/reference/Model/OmrDetailsStepData.md new file mode 100644 index 0000000..3e21072 --- /dev/null +++ b/docs/reference/Model/OmrDetailsStepData.md @@ -0,0 +1,11 @@ +# OmrDetailsStepData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**step** | **string** | Discriminator for `OmrPendingStep.data`; always `details` for this payload. | +**title** | **string** | OCR-detected work title. | [optional] +**instruments** | [**\Flat\APIClient\Model\OmrDetectedInstrument[]**](OmrDetectedInstrument.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OmrDetailsSubmission.md b/docs/reference/Model/OmrDetailsSubmission.md new file mode 100644 index 0000000..b36edbc --- /dev/null +++ b/docs/reference/Model/OmrDetailsSubmission.md @@ -0,0 +1,12 @@ +# OmrDetailsSubmission + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**step** | **string** | Discriminator for `OmrStepSubmission`; always `details` for this submission. | +**title** | **string** | Override the detected work title. | [optional] +**main_language** | **string** | Override the main language (BCP 47) used for lyric and text reading on resume. Defaults to the job locale (`locales`); set this to correct it on the review screen. | [optional] +**instruments** | [**\Flat\APIClient\Model\OmrInstrumentOverride[]**](OmrInstrumentOverride.md) | Per-part overrides, each matched to a detected part by `index`. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OmrDetectedInstrument.md b/docs/reference/Model/OmrDetectedInstrument.md new file mode 100644 index 0000000..8575e3e --- /dev/null +++ b/docs/reference/Model/OmrDetectedInstrument.md @@ -0,0 +1,15 @@ +# OmrDetectedInstrument + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**index** | **int** | 0-based position of the part in the score. | +**part_name** | **string** | Verbatim part name read from the score. | [optional] +**instrument_id** | **string** | Flat instrument ID in dotted `<group>.<instrument>` form, for example `brass.horn` or `vocals.voice-oohs`. See the [Instrument IDs reference](https://flat.io/developers/docs/api/instruments). Always the canonical (non-premium) ID. | [optional] +**instrument_name** | **string** | Localized display name, resolved server-side so the client needs no instruments dictionary. | [optional] +**midi_program** | **int** | General MIDI program number. | [optional] +**transpose_key** | **string** | Transposition or written key shown in the UI, for example `F` for Horn in F. | [optional] +**resolved_confidence** | **string** | Server confidence in the resolved instrument match. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OmrImportedMetadata.md b/docs/reference/Model/OmrImportedMetadata.md new file mode 100644 index 0000000..cca7ded --- /dev/null +++ b/docs/reference/Model/OmrImportedMetadata.md @@ -0,0 +1,12 @@ +# OmrImportedMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**instruments** | **string[]** | Instrument IDs of the assembled parts. | [optional] +**number_measures** | **int** | Number of measures in the recognized score. | [optional] +**main_tempo_qpm** | **float** | Main tempo, in quarter notes per minute. | [optional] +**main_key_signature** | **int** | Main key signature as a fifths count (negative for flats, positive for sharps, 0 for C major / A minor). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OmrInstrumentOverride.md b/docs/reference/Model/OmrInstrumentOverride.md new file mode 100644 index 0000000..5196259 --- /dev/null +++ b/docs/reference/Model/OmrInstrumentOverride.md @@ -0,0 +1,13 @@ +# OmrInstrumentOverride + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**index** | **int** | 0-based position of the part to override, matching the `index` of the detected part. | +**instrument_id** | **string** | Override the resolved instrument with this Flat instrument id, for example `brass.horn`. See the [Instrument IDs reference](https://flat.io/developers/docs/api/instruments) for valid values. Both the dotted `<group>.<instrument>` form (`brass.horn`) and the bare instrument key (`horn`) are accepted. Use this or `midiProgram`. Takes precedence over `midiProgram` when both are set. | [optional] +**part_name** | **string** | Override the part name. | [optional] +**transpose_key** | **string** | Override the transposition / written key: a pitch class as a letter `A`-`G` with an optional accidental. For example `F` for Horn in F or `Bb` for a B flat clarinet. The accidental may be ASCII `b` (flat) or `#` (sharp), or the Unicode music glyphs `♭` (U+266D) and `♯` (U+266F). Unicode accidentals are normalized to their ASCII equivalent, so `B♭` is stored and returned as `Bb`. | [optional] +**midi_program** | **int** | Override the instrument with a standard General MIDI program number (0-127), resolved server-side to the matching Flat instrument. Use this when you do not want to map Flat instrument ids. Ignored if `instrumentId` is also set. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OmrJob.md b/docs/reference/Model/OmrJob.md new file mode 100644 index 0000000..9225f38 --- /dev/null +++ b/docs/reference/Model/OmrJob.md @@ -0,0 +1,25 @@ +# OmrJob + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of the OMR job. | +**status** | [**\Flat\APIClient\Model\OmrJobStatus**](OmrJobStatus.md) | | +**output** | [**\Flat\APIClient\Model\OmrJobOutput**](OmrJobOutput.md) | | +**interactive_steps** | [**\Flat\APIClient\Model\OmrStepName[]**](OmrStepName.md) | Steps this job pauses at for client input, echoing the value set at creation. | +**locales** | **string[]** | Locale hints (BCP 47) the job was created with, used for OCR and as the default main language at the `details` step. | [optional] +**current_step** | [**\Flat\APIClient\Model\OmrStepName**](OmrStepName.md) | The pending step when `status` is `awaitingInput`. Omitted otherwise. | [optional] +**pending_step** | [**\Flat\APIClient\Model\OmrPendingStep**](OmrPendingStep.md) | | [optional] +**estimated_credits** | **int** | Credits that will be or were charged at start (page-based), so a client can show a confirmation before charging. | [optional] +**progress** | [**\Flat\APIClient\Model\OmrJobProgress**](OmrJobProgress.md) | | [optional] +**original_file_metadata** | [**\Flat\APIClient\Model\OmrJobFileMetadata**](OmrJobFileMetadata.md) | | [optional] +**imported_metadata** | [**\Flat\APIClient\Model\OmrImportedMetadata**](OmrImportedMetadata.md) | | [optional] +**result** | [**\Flat\APIClient\Model\OmrJobResult**](OmrJobResult.md) | | [optional] +**retention** | [**\Flat\APIClient\Model\OmrJobRetention**](OmrJobRetention.md) | | [optional] +**error_code** | **string** | Stable, engine-agnostic failure code, present when `status` is `error`. Branch on this for custom handling, and render `errorMessage` for the user-facing text. This is an open string: new codes may be added over time, so keep a generic fallback and never hardcode an exhaustive switch. Current values: * `NO_MUSIC_DETECTED`: no musical content found (poor scan, rotated page, or tablature). * `CORRUPTED_FILE`: the input file is corrupted and could not be read. * `UNSUPPORTED_FORMAT`: the file format or notation is not supported yet. * `UNSUPPORTED_TABLATURE`: the file is guitar tablature, not supported yet. * `ENCRYPTED_PDF`: the PDF is password-protected. * `TOO_LARGE`: the document is too large or has an unusual shape to process. * `ENGINE_TIMEOUT`: recognition took longer than expected and was stopped. * `GENERIC`: unspecified failure. | [optional] +**error_message** | **string** | Localized, user-facing error message, present when `status` is `error`. Rendered in the caller's locale and safe to display as-is. Pair with `errorCode` for branching. | [optional] +**creation_date** | **\DateTime** | When the job was created. | [optional] +**modification_date** | **\DateTime** | When the job was last updated. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OmrJobCreation.md b/docs/reference/Model/OmrJobCreation.md new file mode 100644 index 0000000..d9341b8 --- /dev/null +++ b/docs/reference/Model/OmrJobCreation.md @@ -0,0 +1,15 @@ +# OmrJobCreation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**output** | [**\Flat\APIClient\Model\OmrJobOutput**](OmrJobOutput.md) | | [optional] +**interactive_steps** | [**\Flat\APIClient\Model\OmrStepName[]**](OmrStepName.md) | Steps at which the pipeline should pause for this client. Omit or send `[]` for a fully automatic import. The server only pauses at the steps listed here; declare only steps your client can actually render. | [optional] [default to []] +**locales** | **string[]** | Locale hints (BCP 47) to improve text and lyric detection, for example `[\"ja\", \"en\"]`. The first entry drives the OCR reader. This is the input hint; the detected main language is confirmed later at the `details` step. | [optional] +**collection** | **string** | Target collection ID. Only used when `output` is `library`. | [optional] +**idempotency_key** | **string** | Optional client-supplied key. A retry with the same key returns the existing job instead of creating a duplicate, for safe retries on flaky networks. | [optional] +**files** | [**\Flat\APIClient\Model\OmrJobInputFile[]**](OmrJobInputFile.md) | Optional inline inputs for a one-shot import. For multi-image or mobile capture, omit this and use `addOmrJobFile`. | [optional] +**auto_start** | **bool** | Start processing immediately. Only valid when `files` is provided. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OmrJobFileMetadata.md b/docs/reference/Model/OmrJobFileMetadata.md new file mode 100644 index 0000000..72ac4a7 --- /dev/null +++ b/docs/reference/Model/OmrJobFileMetadata.md @@ -0,0 +1,14 @@ +# OmrJobFileMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**number_of_pages** | **int** | Total number of pages across all input files. | [optional] +**file_count** | **int** | Number of input files attached. | [optional] +**filename** | **string** | Original filename of the input as uploaded (of the first file when several were combined). | [optional] +**file_size** | **int** | Combined size of the input files, in bytes. | [optional] +**mime_type** | **string** | MIME type of the input (of the first file when several were combined). | [optional] +**file_extension** | **string** | File extension of the input, without the leading dot (for example `pdf`). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OmrJobFileUpload.md b/docs/reference/Model/OmrJobFileUpload.md new file mode 100644 index 0000000..1ff9b72 --- /dev/null +++ b/docs/reference/Model/OmrJobFileUpload.md @@ -0,0 +1,10 @@ +# OmrJobFileUpload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | **string** | File data, base64-encoded. The type is read from the content itself, so no declared MIME type or filename extension is needed. Accepted types are listed by `getOmrCapabilities` in `acceptedMimeTypes`. | +**filename** | **string** | Optional original filename, kept for display. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OmrJobFileUploadResult.md b/docs/reference/Model/OmrJobFileUploadResult.md new file mode 100644 index 0000000..5538b72 --- /dev/null +++ b/docs/reference/Model/OmrJobFileUploadResult.md @@ -0,0 +1,10 @@ +# OmrJobFileUploadResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file_index** | **int** | 0-based index assigned to the uploaded file. | [optional] +**file_count** | **int** | Total number of files now attached to the job. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OmrJobInputFile.md b/docs/reference/Model/OmrJobInputFile.md new file mode 100644 index 0000000..4772b44 --- /dev/null +++ b/docs/reference/Model/OmrJobInputFile.md @@ -0,0 +1,10 @@ +# OmrJobInputFile + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | **string** | File data, base64-encoded. The type is read from the content itself, so no declared MIME type or filename extension is needed. Accepted types are listed by `getOmrCapabilities` in `acceptedMimeTypes`. | +**filename** | **string** | Optional original filename, kept for display. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OmrJobOutput.md b/docs/reference/Model/OmrJobOutput.md new file mode 100644 index 0000000..33f9107 --- /dev/null +++ b/docs/reference/Model/OmrJobOutput.md @@ -0,0 +1,8 @@ +# OmrJobOutput + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OmrJobProgress.md b/docs/reference/Model/OmrJobProgress.md new file mode 100644 index 0000000..2141928 --- /dev/null +++ b/docs/reference/Model/OmrJobProgress.md @@ -0,0 +1,11 @@ +# OmrJobProgress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**percent** | **float** | Completion percentage (0-100). | [optional] +**text** | **string** | Localized progress message, ready to display. | [optional] +**key** | **string** | Stable progress key (for example `OMR_QUEUED`, `OMR_PROCESSING_PAGE`, `OMR_CREATING_SCORE`), for matching the current phase in a stepper UI independent of locale. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OmrJobResult.md b/docs/reference/Model/OmrJobResult.md new file mode 100644 index 0000000..b366a16 --- /dev/null +++ b/docs/reference/Model/OmrJobResult.md @@ -0,0 +1,10 @@ +# OmrJobResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**score** | **string** | Created score ID, when `output` is `library`. | [optional] +**exports** | **string[]** | Formats available via `getOmrJobExport`, for example `[\"musicxml\", \"mxl\", \"midi\"]`. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OmrJobRetention.md b/docs/reference/Model/OmrJobRetention.md new file mode 100644 index 0000000..3993a0f --- /dev/null +++ b/docs/reference/Model/OmrJobRetention.md @@ -0,0 +1,10 @@ +# OmrJobRetention + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**expiry_date** | **\DateTime** | When this job's uploaded files and recognition results become eligible for erasure. Fixed when the job is created: changing the account's retention period does not move the deadline of jobs that already exist. | +**expired_date** | **\DateTime** | When the job's stored files were actually erased. Present only once that happened. An expired job keeps the `status` it finished with and stays listable, but its `result` is no longer served and downloads fail with `OMR_JOB_EXPIRED`. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OmrJobStatus.md b/docs/reference/Model/OmrJobStatus.md new file mode 100644 index 0000000..776e783 --- /dev/null +++ b/docs/reference/Model/OmrJobStatus.md @@ -0,0 +1,8 @@ +# OmrJobStatus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OmrLocaleDetails.md b/docs/reference/Model/OmrLocaleDetails.md new file mode 100644 index 0000000..820671e --- /dev/null +++ b/docs/reference/Model/OmrLocaleDetails.md @@ -0,0 +1,10 @@ +# OmrLocaleDetails + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **string** | BCP 47 locale code. Always one of the codes listed in `locales`. | +**name** | **string** | English name of the language, for display in a picker. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OmrPendingStep.md b/docs/reference/Model/OmrPendingStep.md new file mode 100644 index 0000000..cbc560d --- /dev/null +++ b/docs/reference/Model/OmrPendingStep.md @@ -0,0 +1,10 @@ +# OmrPendingStep + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**step** | [**\Flat\APIClient\Model\OmrStepName**](OmrStepName.md) | | +**data** | [**\Flat\APIClient\Model\OmrDetailsStepData**](OmrDetailsStepData.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OmrStepName.md b/docs/reference/Model/OmrStepName.md new file mode 100644 index 0000000..2763920 --- /dev/null +++ b/docs/reference/Model/OmrStepName.md @@ -0,0 +1,8 @@ +# OmrStepName + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OrganizationInvitation.md b/docs/reference/Model/OrganizationInvitation.md new file mode 100644 index 0000000..2318b59 --- /dev/null +++ b/docs/reference/Model/OrganizationInvitation.md @@ -0,0 +1,18 @@ +# OrganizationInvitation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The invitation unique identifier | [optional] +**creation_date** | **\DateTime** | The creation date of the invitation | [optional] +**organization** | **string** | The unique identifier of the Organization owning this class | +**organization_role** | [**\Flat\APIClient\Model\OrganizationRoles**](OrganizationRoles.md) | | +**custom_code** | **string** | Enrollment code to use when joining this organization | +**email** | **string** | The email address this invitation was sent to | [optional] +**invited_by** | **string** | The unique identifier of the User who created this invitation | [optional] +**html_url** | **string** | URL to join the organization using this invitation | [optional] +**allow_multiple_use** | **bool** | If true, the invitation can be used multiple times. If false, the invitation can only be used once. | +**used_by** | **string[]** | List of users who used this invitation | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OrganizationInvitationCreation.md b/docs/reference/Model/OrganizationInvitationCreation.md new file mode 100644 index 0000000..249d344 --- /dev/null +++ b/docs/reference/Model/OrganizationInvitationCreation.md @@ -0,0 +1,10 @@ +# OrganizationInvitationCreation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email** | **string** | The email address you want to send the invitation to | [optional] +**organization_role** | **string** | User's Organization Role | [optional] [default to 'teacher'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OrganizationRoles.md b/docs/reference/Model/OrganizationRoles.md new file mode 100644 index 0000000..c6cd1b2 --- /dev/null +++ b/docs/reference/Model/OrganizationRoles.md @@ -0,0 +1,8 @@ +# OrganizationRoles + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/OrganizationUserAccessTokenCreation.md b/docs/reference/Model/OrganizationUserAccessTokenCreation.md new file mode 100644 index 0000000..daab5c8 --- /dev/null +++ b/docs/reference/Model/OrganizationUserAccessTokenCreation.md @@ -0,0 +1,9 @@ +# OrganizationUserAccessTokenCreation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**scopes** | [**\Flat\APIClient\Model\AppScopes[]**](AppScopes.md) | List of requested scopes for this credential | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/RenameGroupRequest.md b/docs/reference/Model/RenameGroupRequest.md new file mode 100644 index 0000000..79c007a --- /dev/null +++ b/docs/reference/Model/RenameGroupRequest.md @@ -0,0 +1,9 @@ +# RenameGroupRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | New name for the group | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ResourceCollaborator.md b/docs/reference/Model/ResourceCollaborator.md new file mode 100644 index 0000000..4430dfd --- /dev/null +++ b/docs/reference/Model/ResourceCollaborator.md @@ -0,0 +1,21 @@ +# ResourceCollaborator + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**acl_read** | **bool** | `True` if the current user can read the current document | [default to false] +**acl_write** | **bool** | `True` if the current user can modify the current document. If this is a right of a Collection, the capabilities of the associated user can be lower than this permission, check out the `capabilities` property as the end-user to have the complete possibilities with the collection. | [default to false] +**acl_admin** | **bool** | `True` if the current user can manage the current document (i.e. share, delete) If this is a right of a Collection, the capabilities of the associated user can be lower than this permission, check out the `capabilities` property as the end-user to have the complete possibilities with the collection. | [default to false] +**is_collaborator** | **bool** | `True` if the current user is a collaborator of the current document (direct or via group). | [optional] [default to false] +**collaborator_type** | **string** | The type of the collaborator for the resource | [optional] +**id** | **string** | The unique identifier of the permission | [optional] +**date** | **\DateTime** | The date when the permission was added | [optional] +**score** | **string** | If this object is a permission of a score, this property will contain the unique identifier of the score | [optional] +**collection** | **string** | If this object is a permission of a collection, this property will contain the unique identifier of the collection | [optional] +**user** | [**\Flat\APIClient\Model\UserPublic**](UserPublic.md) | | [optional] +**group** | [**\Flat\APIClient\Model\Group**](Group.md) | | [optional] +**user_email** | **string** | If the collaborator is not a user of Flat yet, this field will contain their email. | [optional] +**invited** | **bool** | If this property is `true`, this is still a pending invitation | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ResourceCollaboratorCreation.md b/docs/reference/Model/ResourceCollaboratorCreation.md new file mode 100644 index 0000000..0100b46 --- /dev/null +++ b/docs/reference/Model/ResourceCollaboratorCreation.md @@ -0,0 +1,15 @@ +# ResourceCollaboratorCreation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**user** | **string** | The unique identifier of a Flat user | [optional] +**group** | **string** | The unique identifier of a Flat group | [optional] +**user_email** | **string** | Fill this field to invite an individual user by email. | [optional] +**user_token** | **string** | Token received in an invitation to join the score. | [optional] +**acl_read** | **bool** | `True` if the related user can read the score. (probably true if the user has a permission on the document). | [optional] [default to true] +**acl_write** | **bool** | `True` if the related user can modify the score. | [optional] [default to false] +**acl_admin** | **bool** | `True` if the related user can can manage the current document, i.e. changing the document permissions and deleting the document | [optional] [default to false] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ResourceRights.md b/docs/reference/Model/ResourceRights.md new file mode 100644 index 0000000..e21cba6 --- /dev/null +++ b/docs/reference/Model/ResourceRights.md @@ -0,0 +1,13 @@ +# ResourceRights + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**acl_read** | **bool** | `True` if the current user can read the current document | [default to false] +**acl_write** | **bool** | `True` if the current user can modify the current document. If this is a right of a Collection, the capabilities of the associated user can be lower than this permission, check out the `capabilities` property as the end-user to have the complete possibilities with the collection. | [default to false] +**acl_admin** | **bool** | `True` if the current user can manage the current document (i.e. share, delete) If this is a right of a Collection, the capabilities of the associated user can be lower than this permission, check out the `capabilities` property as the end-user to have the complete possibilities with the collection. | [default to false] +**is_collaborator** | **bool** | `True` if the current user is a collaborator of the current document (direct or via group). | [optional] [default to false] +**collaborator_type** | **string** | The type of the collaborator for the resource | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreComment.md b/docs/reference/Model/ScoreComment.md new file mode 100644 index 0000000..83ff0fd --- /dev/null +++ b/docs/reference/Model/ScoreComment.md @@ -0,0 +1,24 @@ +# ScoreComment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The comment unique identifier | +**type** | **string** | The type of the comment | +**user** | **string** | The author unique identifier | +**score** | **string** | The unique identifier of the score where the comment was posted | +**revision** | **string** | The unique identifier of revision the comment was posted | [optional] +**reply_to** | **string** | When the comment is a reply to another comment, the unique identifier of the parent comment | [optional] +**date** | **\DateTime** | The date when the comment was posted | +**modification_date** | **\DateTime** | The date of the last comment modification | [optional] +**comment** | **string** | The comment text that can includes mentions using the following format: `@[id:username]`. | +**raw_comment** | **string** | A raw version of the comment, that can be displayed without parsing the mentions. | +**context** | [**\Flat\APIClient\Model\ScoreCommentContext**](ScoreCommentContext.md) | | [optional] +**mentions** | **string[]** | The list of user identifier mentioned on the score | [optional] +**resolved** | **bool** | For inline comments, the comment can be marked as resolved and will be hidden in the future responses | [optional] +**resolved_by** | **string** | If the user is marked as resolved, this will contain the unique identifier of the User who marked this comment as resolved | [optional] +**moderation** | [**\Flat\APIClient\Model\ScoreCommentModeration**](ScoreCommentModeration.md) | | [optional] +**spam** | **bool** | `true if the message has been detected as spam and hidden from other users | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreCommentContext.md b/docs/reference/Model/ScoreCommentContext.md new file mode 100644 index 0000000..546adf5 --- /dev/null +++ b/docs/reference/Model/ScoreCommentContext.md @@ -0,0 +1,16 @@ +# ScoreCommentContext + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**part_uuid** | **string** | The unique identifier (UUID) of the score part | +**staff_idx** | **float** | (Deprecated, use `staffUuid`) The identififer of the staff | [optional] +**staff_uuid** | **string** | The unique identififer (UUID) of the staff | [optional] +**measure_uuids** | **string[]** | The list of measure UUIds | +**start_time_pos** | **float** | | +**stop_time_pos** | **float** | | +**start_dpq** | **float** | | +**stop_dpq** | **float** | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreCommentCreation.md b/docs/reference/Model/ScoreCommentCreation.md new file mode 100644 index 0000000..402ade6 --- /dev/null +++ b/docs/reference/Model/ScoreCommentCreation.md @@ -0,0 +1,14 @@ +# ScoreCommentCreation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**revision** | **string** | The unique identifier of the revision of the score where the comment was added. If this property is unspecified or contains \"last\", the API will automatically take the last revision created. | [optional] +**comment** | **string** | The comment text that can includes mentions using the following format: `@[id:username]`. | +**raw_comment** | **string** | A raw version of the comment, that can be displayed without the mentions. If you use mentions, this property must be set. | [optional] +**mentions** | **string[]** | The list of user identifiers mentioned in this comment | [optional] +**reply_to** | **string** | When the comment is a reply to another comment, the unique identifier of the parent comment | [optional] +**context** | [**\Flat\APIClient\Model\ScoreCommentContext**](ScoreCommentContext.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreCommentModeration.md b/docs/reference/Model/ScoreCommentModeration.md new file mode 100644 index 0000000..7f66cfc --- /dev/null +++ b/docs/reference/Model/ScoreCommentModeration.md @@ -0,0 +1,10 @@ +# ScoreCommentModeration + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**hidden** | **bool** | If true, this comment will be hidden from other users | [optional] +**reason** | **string** | If the comment is hidden, the reason why this one has been moderated | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreCommentUpdate.md b/docs/reference/Model/ScoreCommentUpdate.md new file mode 100644 index 0000000..9c6d114 --- /dev/null +++ b/docs/reference/Model/ScoreCommentUpdate.md @@ -0,0 +1,12 @@ +# ScoreCommentUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**revision** | **string** | The unique identifier of the revision of the score where the comment was added. If this property is unspecified or contains \"last\", the API will automatically take the last revision created. | [optional] +**comment** | **string** | The comment text that can includes mentions using the following format: `@[id:username]`. | [optional] +**raw_comment** | **string** | A raw version of the comment, that can be displayed without the mentions. If you use mentions, this property must be set. | [optional] +**context** | [**\Flat\APIClient\Model\ScoreCommentContext**](ScoreCommentContext.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreCommentsCounts.md b/docs/reference/Model/ScoreCommentsCounts.md new file mode 100644 index 0000000..0da20f5 --- /dev/null +++ b/docs/reference/Model/ScoreCommentsCounts.md @@ -0,0 +1,13 @@ +# ScoreCommentsCounts + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total** | **float** | The total number of comments added to the score | [optional] +**unique** | **float** | The unique (1/user) number of comments added to the score | [optional] +**weekly** | **float** | The weekly unique number of comments added to the score | [optional] +**monthly** | **float** | The monthly unique number of comments added to the score | [optional] +**yearly** | **float** | The yearly unique number of comments added to the score | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreCreation.md b/docs/reference/Model/ScoreCreation.md new file mode 100644 index 0000000..513c971 --- /dev/null +++ b/docs/reference/Model/ScoreCreation.md @@ -0,0 +1,12 @@ +# ScoreCreation + +This model is a `oneOf` wrapper: a value is exactly one of the member types listed below. +It is never instantiated directly — use one of the concrete types. + +## oneOf + +- [**\Flat\APIClient\Model\ScoreCreationBuilderData**](ScoreCreationBuilderData.md) +- [**\Flat\APIClient\Model\ScoreCreationFileImport**](ScoreCreationFileImport.md) +- [**\Flat\APIClient\Model\ScoreCreationGoogleDriveImport**](ScoreCreationGoogleDriveImport.md) + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreCreationBuilderData.md b/docs/reference/Model/ScoreCreationBuilderData.md new file mode 100644 index 0000000..87b9933 --- /dev/null +++ b/docs/reference/Model/ScoreCreationBuilderData.md @@ -0,0 +1,13 @@ +# ScoreCreationBuilderData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | The title of the new score. If the title is too long, the API may trim this one. If this title is not specified, the API will try to (in this order): - Use the title contained in the file (e.g. [`movement-title`](https://usermanuals.musicxml.com/MusicXML/Content/EL-MusicXML-movement-title.htm) or [`credit-words`](https://usermanuals.musicxml.com/MusicXML/Content/EL-MusicXML-credit-words.htm) for [MusicXML](http://www.musicxml.com/) files). - Use the name of the file for files from a specified `source` (e.g. Google Drive) or the one in the `filename` property - Set a default title (e.g. \"New Music Score\") | [optional] +**privacy** | [**\Flat\APIClient\Model\ScorePrivacy**](ScorePrivacy.md) | | [optional] +**collection** | **string** | Unique identifier of a collection where the score will be created. If no collection identifier is provided, the score will not be added to any collection and will only be visible in the `allScores` virtual collection. | [optional] +**google_drive_folder** | **string** | If the user uses Google Drive and this properties is specified, the file will be created in this directory. The currently user creating the file must be granted to write in this directory. | [optional] +**builder_data** | [**\Flat\APIClient\Model\ScoreCreationBuilderDataAllOfBuilderData**](ScoreCreationBuilderDataAllOfBuilderData.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreCreationBuilderDataAllOfBuilderData.md b/docs/reference/Model/ScoreCreationBuilderDataAllOfBuilderData.md new file mode 100644 index 0000000..e628384 --- /dev/null +++ b/docs/reference/Model/ScoreCreationBuilderDataAllOfBuilderData.md @@ -0,0 +1,10 @@ +# ScoreCreationBuilderDataAllOfBuilderData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**score_data** | [**\Flat\APIClient\Model\ScoreCreationBuilderDataAllOfBuilderDataScoreData**](ScoreCreationBuilderDataAllOfBuilderDataScoreData.md) | | +**layout_data** | [**\Flat\APIClient\Model\ScoreCreationBuilderDataAllOfBuilderDataLayoutData**](ScoreCreationBuilderDataAllOfBuilderDataLayoutData.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreCreationBuilderDataAllOfBuilderDataLayoutData.md b/docs/reference/Model/ScoreCreationBuilderDataAllOfBuilderDataLayoutData.md new file mode 100644 index 0000000..40fa7db --- /dev/null +++ b/docs/reference/Model/ScoreCreationBuilderDataAllOfBuilderDataLayoutData.md @@ -0,0 +1,16 @@ +# ScoreCreationBuilderDataAllOfBuilderDataLayoutData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**notes_spacing_coeff** | **float** | A float value >= 1 that controls the spacing between notes. | [optional] +**length_unit** | **string** | The unit to use for layout customizations | [optional] [default to 'cm'] +**page_height** | **float** | The height of the page in chosen unit (`lengthUnit`). | [optional] +**page_width** | **float** | The width of the page in chosen unit (`lengthUnit`). | [optional] +**page_margin_top** | **float** | The top margin of the page in chosen unit (`lengthUnit`). | [optional] +**page_margin_bottom** | **float** | The bottom margin of the page in chosen unit (`lengthUnit`). | [optional] +**page_margin_left** | **float** | The left margin of the page in chosen unit (`lengthUnit`). | [optional] +**page_margin_right** | **float** | The right margin of the page in chosen unit (`lengthUnit`). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreCreationBuilderDataAllOfBuilderDataScoreData.md b/docs/reference/Model/ScoreCreationBuilderDataAllOfBuilderDataScoreData.md new file mode 100644 index 0000000..e6ca4dc --- /dev/null +++ b/docs/reference/Model/ScoreCreationBuilderDataAllOfBuilderDataScoreData.md @@ -0,0 +1,14 @@ +# ScoreCreationBuilderDataAllOfBuilderDataScoreData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**use_tab_staff** | **bool** | true if the TAB staff is displayed with fretted instruments | [optional] +**use_chord_grid** | **bool** | true if the chord grid must be displayed with fretted instruments | [optional] +**fifths** | **float** | The key signature of the score (expressed between -7 and 7). Major C is used when the value is not provided. | [optional] +**nb_beats** | **float** | The number of beats in the measure | [optional] +**beat_type** | **float** | The duration of a beat in the measure | [optional] +**instruments** | [**\Flat\APIClient\Model\ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments[]**](ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments.md) | The list of instruments to add to the score. See the [Instrument IDs reference](https://flat.io/developers/docs/api/instruments) for the possible values for `group` and `instrument` (also available as the [`@flat/instruments`](https://www.npmjs.com/package/@flat/instruments) package). | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments.md b/docs/reference/Model/ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments.md new file mode 100644 index 0000000..50da9f5 --- /dev/null +++ b/docs/reference/Model/ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments.md @@ -0,0 +1,13 @@ +# ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**group** | **string** | The of the instrument group (e.g. `keyboards`, `brass`) | +**instrument** | **string** | The identifier of the instrument (e.g. `piano`, `trumpet`) | +**long_name** | **string** | The full name of the instrument | [optional] +**short_name** | **string** | The abbreviation of the name of the instrument | [optional] +**has_quarter_tone** | **bool** | True if the part can use quarter tone (prevent the part to have a TAB/chord grid) | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreCreationCommon.md b/docs/reference/Model/ScoreCreationCommon.md new file mode 100644 index 0000000..370cb64 --- /dev/null +++ b/docs/reference/Model/ScoreCreationCommon.md @@ -0,0 +1,12 @@ +# ScoreCreationCommon + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | The title of the new score. If the title is too long, the API may trim this one. If this title is not specified, the API will try to (in this order): - Use the title contained in the file (e.g. [`movement-title`](https://usermanuals.musicxml.com/MusicXML/Content/EL-MusicXML-movement-title.htm) or [`credit-words`](https://usermanuals.musicxml.com/MusicXML/Content/EL-MusicXML-credit-words.htm) for [MusicXML](http://www.musicxml.com/) files). - Use the name of the file for files from a specified `source` (e.g. Google Drive) or the one in the `filename` property - Set a default title (e.g. \"New Music Score\") | [optional] +**privacy** | [**\Flat\APIClient\Model\ScorePrivacy**](ScorePrivacy.md) | | [optional] +**collection** | **string** | Unique identifier of a collection where the score will be created. If no collection identifier is provided, the score will not be added to any collection and will only be visible in the `allScores` virtual collection. | [optional] +**google_drive_folder** | **string** | If the user uses Google Drive and this properties is specified, the file will be created in this directory. The currently user creating the file must be granted to write in this directory. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreCreationFileImport.md b/docs/reference/Model/ScoreCreationFileImport.md new file mode 100644 index 0000000..30e9012 --- /dev/null +++ b/docs/reference/Model/ScoreCreationFileImport.md @@ -0,0 +1,16 @@ +# ScoreCreationFileImport + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | The title of the new score. If the title is too long, the API may trim this one. If this title is not specified, the API will try to (in this order): - Use the title contained in the file (e.g. [`movement-title`](https://usermanuals.musicxml.com/MusicXML/Content/EL-MusicXML-movement-title.htm) or [`credit-words`](https://usermanuals.musicxml.com/MusicXML/Content/EL-MusicXML-credit-words.htm) for [MusicXML](http://www.musicxml.com/) files). - Use the name of the file for files from a specified `source` (e.g. Google Drive) or the one in the `filename` property - Set a default title (e.g. \"New Music Score\") | [optional] +**privacy** | [**\Flat\APIClient\Model\ScorePrivacy**](ScorePrivacy.md) | | [optional] +**collection** | **string** | Unique identifier of a collection where the score will be created. If no collection identifier is provided, the score will not be added to any collection and will only be visible in the `allScores` virtual collection. | [optional] +**google_drive_folder** | **string** | If the user uses Google Drive and this properties is specified, the file will be created in this directory. The currently user creating the file must be granted to write in this directory. | [optional] +**filename** | **string** | If this is an imported file, its filename | [optional] +**data** | **string** | The data of the score file. See the `POST /scores` endpoint description for the full list of supported formats. Binary payloads (e.g. compressed MusicXML, MIDI, Guitar Pro) can be encoded in Base64, in this case the `dataEncoding` property must match the encoding used for the API request. | +**data_encoding** | **string** | The optional encoding of the score data. This property must match the encoding used for the `data` property. | [optional] +**supports_tasks** | **bool** | Set this to `true` if the client supports asynchronous task flows. When importing a score that requires OMR processing (a PDF or a page image), the API will return a 202 Accepted response along with a task reference. The client can then check the task status using the endpoint `GET /v2/tasks/{task}`. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreCreationGoogleDriveImport.md b/docs/reference/Model/ScoreCreationGoogleDriveImport.md new file mode 100644 index 0000000..94d02d6 --- /dev/null +++ b/docs/reference/Model/ScoreCreationGoogleDriveImport.md @@ -0,0 +1,13 @@ +# ScoreCreationGoogleDriveImport + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | The title of the new score. If the title is too long, the API may trim this one. If this title is not specified, the API will try to (in this order): - Use the title contained in the file (e.g. [`movement-title`](https://usermanuals.musicxml.com/MusicXML/Content/EL-MusicXML-movement-title.htm) or [`credit-words`](https://usermanuals.musicxml.com/MusicXML/Content/EL-MusicXML-credit-words.htm) for [MusicXML](http://www.musicxml.com/) files). - Use the name of the file for files from a specified `source` (e.g. Google Drive) or the one in the `filename` property - Set a default title (e.g. \"New Music Score\") | [optional] +**privacy** | [**\Flat\APIClient\Model\ScorePrivacy**](ScorePrivacy.md) | | [optional] +**collection** | **string** | Unique identifier of a collection where the score will be created. If no collection identifier is provided, the score will not be added to any collection and will only be visible in the `allScores` virtual collection. | [optional] +**google_drive_folder** | **string** | If the user uses Google Drive and this properties is specified, the file will be created in this directory. The currently user creating the file must be granted to write in this directory. | [optional] +**source** | [**\Flat\APIClient\Model\ScoreSource**](ScoreSource.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreCreationType.md b/docs/reference/Model/ScoreCreationType.md new file mode 100644 index 0000000..2f7cb5e --- /dev/null +++ b/docs/reference/Model/ScoreCreationType.md @@ -0,0 +1,8 @@ +# ScoreCreationType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreDetails.md b/docs/reference/Model/ScoreDetails.md new file mode 100644 index 0000000..cedbda8 --- /dev/null +++ b/docs/reference/Model/ScoreDetails.md @@ -0,0 +1,47 @@ +# ScoreDetails + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The unique identifier of the score | +**sharing_key** | **string** | The private sharing key of the score (available when the `privacy` mode is set to `privateLink`) | [optional] +**title** | **string** | The title of the score | +**privacy** | [**\Flat\APIClient\Model\ScorePrivacy**](ScorePrivacy.md) | | +**user** | [**\Flat\APIClient\Model\UserPublic**](UserPublic.md) | | +**html_url** | **string** | The url where the score can be viewed in a web browser | +**edit_html_url** | **string** | The url where the score can be edited in a web browser | +**subtitle** | **string** | Subtitle of the score | [optional] +**lyricist** | **string** | Lyricist of the score | [optional] +**arranger** | **string** | Arranger of the score | [optional] +**composer** | **string** | Composer of the score | [optional] +**description** | **string** | Description of the creation | [optional] +**tags** | **string[]** | Tags describing the score | [optional] +**creation_type** | [**\Flat\APIClient\Model\ScoreCreationType**](ScoreCreationType.md) | | [optional] +**license** | [**\Flat\APIClient\Model\ScoreLicense**](ScoreLicense.md) | | [optional] +**license_text** | **string** | Additional license text written on the exported/printed score | [optional] +**duration_time** | **float** | In seconds, an approximative duration of the score | [optional] +**number_measures** | **int** | The number of measures in the score | [optional] +**main_tempo_qpm** | **float** | The main tempo of the score (in QPM) | [optional] +**main_key_signature** | **float** | The main key signature of the score (expressed between -7 and 7). | [optional] +**rights** | [**\Flat\APIClient\Model\ResourceRights**](ResourceRights.md) | | [optional] +**collaborators** | [**\Flat\APIClient\Model\ResourceCollaborator[]**](ResourceCollaborator.md) | The list of the collaborators of the score | +**creation_date** | **\DateTime** | The date when the score was created | +**modification_date** | **\DateTime** | The date of the last revision of the score | [optional] +**publication_date** | **\DateTime** | The date when the score was published on Flat | [optional] +**scheduled_deletion_date** | **\DateTime** | The date when the score will be definitively deleted. This date can be in the past if the score will be deleted at the next deletion batch, in this case you can display something like \"Deleted shortly\". Schedule: * For all paying users, the scores will be definitively deleted after 90 days. * For free users, the scores are no longer available after 24 hours, an can be restored with a paying account up to 90 days. | [optional] +**highlighted_date** | **\DateTime** | The date when the score was highlighted (featured) on our community | [optional] +**organization** | **string** | If the score has been created in an organization, the identifier of this organization. This property is especially used with the score privacy `organizationPublic`. | [optional] +**parent_score** | **string** | If the score has been forked, the unique identifier of the parent score. | [optional] +**instruments** | **string[]** | An array of the instrument identifiers used in the last version of the score. This is mainly used to display a list of the instruments in the Flat's UI or instruments icons. The format of the strings is `{instrument-group}.{instrument-id}`. | +**instruments_names** | **string[]** | An array of the instrument names used in the last version of the score. This list is localized and ready-to-display and will match the indexes from the `instruments` list. | +**samples** | **string[]** | An array of the audio samples identifiers used the different score parts. The format of the strings is `{instrument-group}.{sample-id}`. | +**google_drive_file_id** | **string** | If the user uses Google Drive and the score exists on Google Drive, this field will contain the unique identifier of the Flat score on Google Drive. You can access the document using the url: `https://drive.google.com/open?id={googleDriveFileId}` | [optional] +**likes** | [**\Flat\APIClient\Model\ScoreLikesCounts**](ScoreLikesCounts.md) | | [optional] +**comments** | [**\Flat\APIClient\Model\ScoreCommentsCounts**](ScoreCommentsCounts.md) | | [optional] +**views** | [**\Flat\APIClient\Model\ScoreViewsCounts**](ScoreViewsCounts.md) | | [optional] +**plays** | [**\Flat\APIClient\Model\ScorePlaysCounts**](ScorePlaysCounts.md) | | [optional] +**collections** | **string[]** | The List of parent collections, which includes all the collections this score is included. Please note that you might not have access to all of them. | [optional] +**me** | [**\Flat\APIClient\Model\ScoreDetailsAllOfMe**](ScoreDetailsAllOfMe.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreDetailsAllOfMe.md b/docs/reference/Model/ScoreDetailsAllOfMe.md new file mode 100644 index 0000000..5c72ff4 --- /dev/null +++ b/docs/reference/Model/ScoreDetailsAllOfMe.md @@ -0,0 +1,10 @@ +# ScoreDetailsAllOfMe + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**is_liked** | **bool** | True if the current user likes this score | +**is_in_library** | **bool** | True if the score is stored in one of the user's collections | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreFork.md b/docs/reference/Model/ScoreFork.md new file mode 100644 index 0000000..b316d4f --- /dev/null +++ b/docs/reference/Model/ScoreFork.md @@ -0,0 +1,11 @@ +# ScoreFork + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**collection** | **string** | Unique identifier of a collection where the score will be copied. If no collection identifier is provided, a virtual collection is used, or `null` is provided, the score won't be added to any collection and will only be visible in the `allScores` virtual collection. | [optional] +**google_drive_disabled** | **bool** | If set to `true`, the API won't create the score on Google Drive | [optional] [default to false] +**keep_original_title** | **bool** | Option to keep the original title of the score (i.e. don't prepend it with \"Copy of \", or add the student name in assignment usage). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreLicense.md b/docs/reference/Model/ScoreLicense.md new file mode 100644 index 0000000..fd175c5 --- /dev/null +++ b/docs/reference/Model/ScoreLicense.md @@ -0,0 +1,8 @@ +# ScoreLicense + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreLikesCounts.md b/docs/reference/Model/ScoreLikesCounts.md new file mode 100644 index 0000000..0fff6ff --- /dev/null +++ b/docs/reference/Model/ScoreLikesCounts.md @@ -0,0 +1,12 @@ +# ScoreLikesCounts + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total** | **float** | The total number of likes of the score | [optional] +**weekly** | **float** | The number of new likes during the last week | [optional] +**monthly** | **float** | The number of new likes during the last month | [optional] +**yearly** | **float** | The number of new likes during the last year | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreModification.md b/docs/reference/Model/ScoreModification.md new file mode 100644 index 0000000..89646ce --- /dev/null +++ b/docs/reference/Model/ScoreModification.md @@ -0,0 +1,20 @@ +# ScoreModification + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | The title of the score | [optional] +**subtitle** | **string** | The subtitle of the score | [optional] +**composer** | **string** | The composer of the score | [optional] +**lyricist** | **string** | The lyricist of the score | [optional] +**arranger** | **string** | The arranger of the score | [optional] +**privacy** | [**\Flat\APIClient\Model\ScorePrivacy**](ScorePrivacy.md) | | [optional] +**sharing_key** | **string** | When using the `privacy` mode `privateLink`, this property can be used to set a custom sharing key, otherwise a new key will be generated. | [optional] +**description** | **string** | Description of the creation | [optional] +**tags** | **string[]** | Tags describing the score | [optional] +**creation_type** | [**\Flat\APIClient\Model\ScoreCreationType**](ScoreCreationType.md) | | [optional] +**license** | [**\Flat\APIClient\Model\ScoreLicense**](ScoreLicense.md) | | [optional] +**license_text** | **string** | The rights info written on the score | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScorePlaysCounts.md b/docs/reference/Model/ScorePlaysCounts.md new file mode 100644 index 0000000..a5885e5 --- /dev/null +++ b/docs/reference/Model/ScorePlaysCounts.md @@ -0,0 +1,12 @@ +# ScorePlaysCounts + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total** | **float** | The total number of plays of the score | [optional] +**weekly** | **float** | The weekly number of plays of the score | [optional] +**monthly** | **float** | The monthly number of plays of the score | [optional] +**yearly** | **float** | The yearly number of plays of the score | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScorePrivacy.md b/docs/reference/Model/ScorePrivacy.md new file mode 100644 index 0000000..e6e7fb6 --- /dev/null +++ b/docs/reference/Model/ScorePrivacy.md @@ -0,0 +1,8 @@ +# ScorePrivacy + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreRevision.md b/docs/reference/Model/ScoreRevision.md new file mode 100644 index 0000000..d26e79a --- /dev/null +++ b/docs/reference/Model/ScoreRevision.md @@ -0,0 +1,17 @@ +# ScoreRevision + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The unique identifier of the revision. | +**user** | **string** | The user identifier who created the revision | [optional] +**score** | **string** | The score identifier | +**collaborators** | **string[]** | | [optional] +**date** | **\DateTime** | The date when this revision was created | +**event** | **string** | The last event (action id) of the revision | [optional] +**description** | **string** | A description associated to the revision | [optional] +**autosave** | **bool** | True if this revision was automatically generated by Flat and not on purpose by the user. | [optional] +**statistics** | [**\Flat\APIClient\Model\ScoreRevisionStatistics**](ScoreRevisionStatistics.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreRevisionCreation.md b/docs/reference/Model/ScoreRevisionCreation.md new file mode 100644 index 0000000..bf846c9 --- /dev/null +++ b/docs/reference/Model/ScoreRevisionCreation.md @@ -0,0 +1,12 @@ +# ScoreRevisionCreation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | **string** | The data of the score file. It must be a MusicXML 3 file (`vnd.recordare.musicxml` or `vnd.recordare.musicxml+xml`), a MIDI file (`audio/midi`) or a Flat.json (aka Adagio.json) file. Binary payloads (`vnd.recordare.musicxml` and `audio/midi`) can be encoded in Base64, in this case the `dataEncoding` property must match the encoding used for the API request. | +**data_encoding** | **string** | The optional encoding of the score data. This property must match the encoding used for the `data` property. | [optional] +**autosave** | **bool** | Must be set to `true` if the revision was created automatically. | [optional] +**description** | **string** | A description associated to the revision | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreRevisionStatistics.md b/docs/reference/Model/ScoreRevisionStatistics.md new file mode 100644 index 0000000..b21e2c7 --- /dev/null +++ b/docs/reference/Model/ScoreRevisionStatistics.md @@ -0,0 +1,12 @@ +# ScoreRevisionStatistics + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**additions** | **float** | The number of additions operations in the last revision | [optional] +**deletions** | **float** | The number of deletions operations in the last revision | [optional] +**start_date** | **\DateTime** | The date of the first action included in this revision | [optional] +**end_date** | **\DateTime** | The date of the latest action included in this revision | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreSource.md b/docs/reference/Model/ScoreSource.md new file mode 100644 index 0000000..eaa7690 --- /dev/null +++ b/docs/reference/Model/ScoreSource.md @@ -0,0 +1,9 @@ +# ScoreSource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**google_drive** | **string** | If the score is a file on Google Drive, this field property must contain its identifier. To use this method, the Drive file must be public or the Flat Drive App must have access to the file. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreSummary.md b/docs/reference/Model/ScoreSummary.md new file mode 100644 index 0000000..af8d181 --- /dev/null +++ b/docs/reference/Model/ScoreSummary.md @@ -0,0 +1,14 @@ +# ScoreSummary + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The unique identifier of the score | +**sharing_key** | **string** | The private sharing key of the score (available when the `privacy` mode is set to `privateLink`) | [optional] +**title** | **string** | The title of the score | +**privacy** | [**\Flat\APIClient\Model\ScorePrivacy**](ScorePrivacy.md) | | +**user** | [**\Flat\APIClient\Model\UserPublic**](UserPublic.md) | | +**html_url** | **string** | The url where the score can be viewed in a web browser | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreTrack.md b/docs/reference/Model/ScoreTrack.md new file mode 100644 index 0000000..eba8250 --- /dev/null +++ b/docs/reference/Model/ScoreTrack.md @@ -0,0 +1,21 @@ +# ScoreTrack + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The unique identifier of the score track | +**title** | **string** | Title of the track | [optional] +**score** | **string** | The unique identifier of the score. Absent for Free Record performance submissions, which are recorded without an attached score. | [optional] +**creator** | **string** | The unique identifier of the track creator | +**creation_date** | **\DateTime** | The creation date of the track | +**modification_date** | **\DateTime** | The modification date of the track | +**default** | **bool** | True if the track should be used as default audio source | +**state** | [**\Flat\APIClient\Model\ScoreTrackState**](ScoreTrackState.md) | | +**type** | [**\Flat\APIClient\Model\ScoreTrackType**](ScoreTrackType.md) | | +**purpose** | [**\Flat\APIClient\Model\ScoreTrackPurpose**](ScoreTrackPurpose.md) | | +**url** | **string** | The URL of the track | [optional] +**media_id** | **string** | The unique identifier of the track when hosted on an external service. For example, if the url is `https://www.youtube.com/watch?v=dQw4w9WgXcQ`, `mediaId` will be `dQw4w9WgXcQ` | [optional] +**synchronization_points** | [**\Flat\APIClient\Model\ScoreTrackPoint[]**](ScoreTrackPoint.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreTrackCreation.md b/docs/reference/Model/ScoreTrackCreation.md new file mode 100644 index 0000000..bdbc4f5 --- /dev/null +++ b/docs/reference/Model/ScoreTrackCreation.md @@ -0,0 +1,14 @@ +# ScoreTrackCreation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | Title of the track | [optional] +**default** | **bool** | True if the track should be used as default audio source | [optional] +**state** | [**\Flat\APIClient\Model\ScoreTrackState**](ScoreTrackState.md) | | [optional] +**purpose** | [**\Flat\APIClient\Model\ScoreTrackPurpose**](ScoreTrackPurpose.md) | | [optional] +**url** | **string** | The URL of the track | [optional] +**synchronization_points** | [**\Flat\APIClient\Model\ScoreTrackPoint[]**](ScoreTrackPoint.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreTrackCreationResponse.md b/docs/reference/Model/ScoreTrackCreationResponse.md new file mode 100644 index 0000000..8715184 --- /dev/null +++ b/docs/reference/Model/ScoreTrackCreationResponse.md @@ -0,0 +1,9 @@ +# ScoreTrackCreationResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**track** | [**\Flat\APIClient\Model\ScoreTrack**](ScoreTrack.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreTrackPoint.md b/docs/reference/Model/ScoreTrackPoint.md new file mode 100644 index 0000000..ddaa10a --- /dev/null +++ b/docs/reference/Model/ScoreTrackPoint.md @@ -0,0 +1,11 @@ +# ScoreTrackPoint + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | The type of the synchronization point. If the type is `measure`, the measure uuid must be present in `measureUuid` | +**measure_uuid** | **string** | The measure unique identifier | [optional] +**time** | **float** | The corresponding time in seconds | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreTrackPurpose.md b/docs/reference/Model/ScoreTrackPurpose.md new file mode 100644 index 0000000..4ad8234 --- /dev/null +++ b/docs/reference/Model/ScoreTrackPurpose.md @@ -0,0 +1,8 @@ +# ScoreTrackPurpose + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreTrackState.md b/docs/reference/Model/ScoreTrackState.md new file mode 100644 index 0000000..c898cda --- /dev/null +++ b/docs/reference/Model/ScoreTrackState.md @@ -0,0 +1,8 @@ +# ScoreTrackState + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreTrackType.md b/docs/reference/Model/ScoreTrackType.md new file mode 100644 index 0000000..08752b9 --- /dev/null +++ b/docs/reference/Model/ScoreTrackType.md @@ -0,0 +1,8 @@ +# ScoreTrackType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreTrackUpdate.md b/docs/reference/Model/ScoreTrackUpdate.md new file mode 100644 index 0000000..c9f454b --- /dev/null +++ b/docs/reference/Model/ScoreTrackUpdate.md @@ -0,0 +1,13 @@ +# ScoreTrackUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | Title of the track | [optional] +**default** | **bool** | True if the track should be used as default audio source | [optional] +**state** | [**\Flat\APIClient\Model\ScoreTrackState**](ScoreTrackState.md) | | [optional] +**purpose** | [**\Flat\APIClient\Model\ScoreTrackPurpose**](ScoreTrackPurpose.md) | | [optional] +**synchronization_points** | [**\Flat\APIClient\Model\ScoreTrackPoint[]**](ScoreTrackPoint.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/ScoreViewsCounts.md b/docs/reference/Model/ScoreViewsCounts.md new file mode 100644 index 0000000..c37cce6 --- /dev/null +++ b/docs/reference/Model/ScoreViewsCounts.md @@ -0,0 +1,12 @@ +# ScoreViewsCounts + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total** | **float** | The total number of views of the score | [optional] +**weekly** | **float** | The weekly number of views of the score | [optional] +**monthly** | **float** | The monthly number of views of the score | [optional] +**yearly** | **float** | The yearly number of views of the score | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/Task.md b/docs/reference/Model/Task.md new file mode 100644 index 0000000..e544f29 --- /dev/null +++ b/docs/reference/Model/Task.md @@ -0,0 +1,22 @@ +# Task + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of the task | +**type** | **string** | Type of the task: * `audio-export`: Exports a score to audio format (MP3, WAV) * `score-save`: Saves or updates a score document * `import-omr`: Processes a PDF through OMR (Optical Music Recognition) and imports it as a score | [optional] +**state** | **string** | State of the Task | +**format** | **string** | For files processing, the file format (e.g. `mp3`, `wav`) | [optional] +**score** | **string** | The score unique identifier for tasks related to scores | [optional] +**revision** | **string** | The score revision identifier for tasks related to scores | [optional] +**progress** | [**\Flat\APIClient\Model\TaskProgress**](TaskProgress.md) | | [optional] +**creation_date** | **\DateTime** | The creation date of the task | [optional] +**modification_date** | **\DateTime** | The last modification date of the task | [optional] +**done_date** | **\DateTime** | The date when the task has been completed | [optional] +**result** | [**\Flat\APIClient\Model\TaskResult**](TaskResult.md) | | [optional] +**error_history** | **string[]** | If any errors happened when processing this task, the list of errors identifiers | [optional] +**is_cancellable** | **bool** | Whether the task can be canceled by the user. Only `true` when the task is in `created` state (waiting to be processed). | [optional] [readonly] +**children** | [**\Flat\APIClient\Model\Task[]**](Task.md) | Child tasks for hierarchical task structures (e.g., conversion subtasks) | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/TaskExportOptions.md b/docs/reference/Model/TaskExportOptions.md new file mode 100644 index 0000000..985bee1 --- /dev/null +++ b/docs/reference/Model/TaskExportOptions.md @@ -0,0 +1,9 @@ +# TaskExportOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**parts** | **string[]** | A list of parts to specifically export | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/TaskProgress.md b/docs/reference/Model/TaskProgress.md new file mode 100644 index 0000000..1d25e22 --- /dev/null +++ b/docs/reference/Model/TaskProgress.md @@ -0,0 +1,10 @@ +# TaskProgress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**percent** | **float** | Percent of the task progression | [optional] +**text** | **string** | Text details of the task progress | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/TaskResult.md b/docs/reference/Model/TaskResult.md new file mode 100644 index 0000000..f81a8f6 --- /dev/null +++ b/docs/reference/Model/TaskResult.md @@ -0,0 +1,10 @@ +# TaskResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**url** | **string** | URL returned by the task worker | [optional] +**error** | **string** | Error returned by task worker | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/TeachingTheme.md b/docs/reference/Model/TeachingTheme.md new file mode 100644 index 0000000..485cf37 --- /dev/null +++ b/docs/reference/Model/TeachingTheme.md @@ -0,0 +1,8 @@ +# TeachingTheme + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/TutteoProduct.md b/docs/reference/Model/TutteoProduct.md new file mode 100644 index 0000000..8c431b4 --- /dev/null +++ b/docs/reference/Model/TutteoProduct.md @@ -0,0 +1,8 @@ +# TutteoProduct + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/UserAdminUpdate.md b/docs/reference/Model/UserAdminUpdate.md new file mode 100644 index 0000000..1d0ced7 --- /dev/null +++ b/docs/reference/Model/UserAdminUpdate.md @@ -0,0 +1,14 @@ +# UserAdminUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**password** | **string** | Password of the account | [optional] +**organization_role** | [**\Flat\APIClient\Model\OrganizationRoles**](OrganizationRoles.md) | | [optional] +**username** | **string** | Username of the account | [optional] +**firstname** | **string** | First name of the user | [optional] +**lastname** | **string** | Last name of the user | [optional] +**email** | **string** | Email of the account | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/UserAzureDetails.md b/docs/reference/Model/UserAzureDetails.md new file mode 100644 index 0000000..d374707 --- /dev/null +++ b/docs/reference/Model/UserAzureDetails.md @@ -0,0 +1,11 @@ +# UserAzureDetails + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**oid** | **string** | User object identifier on Azure AD | [optional] +**hd** | **string** | User tenant (domain name) | [optional] +**preferred_username** | **string** | User Preferred Username (UPN), i.e. the main email of the user | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/UserBasics.md b/docs/reference/Model/UserBasics.md new file mode 100644 index 0000000..ff06bc4 --- /dev/null +++ b/docs/reference/Model/UserBasics.md @@ -0,0 +1,18 @@ +# UserBasics + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The user unique identifier | +**type** | **string** | The type of user account | +**product** | [**\Flat\APIClient\Model\TutteoProduct**](TutteoProduct.md) | | +**username** | **string** | The user name (unique for the organization) | +**printable_name** | **string** | The name that can be directly printed (name, firstname & lastname, or username) | [optional] +**firstname** | **string** | Firstname of the user (for education users) | [optional] +**lastname** | **string** | Lastname of the user (for education users) | [optional] +**name** | **string** | A displayable name for the user (for consumer users) | [optional] +**picture** | **string** | The URL of the picture to display | +**badges** | **string[]** | List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/UserCommunityProfileLinks.md b/docs/reference/Model/UserCommunityProfileLinks.md new file mode 100644 index 0000000..0eb0fc9 --- /dev/null +++ b/docs/reference/Model/UserCommunityProfileLinks.md @@ -0,0 +1,14 @@ +# UserCommunityProfileLinks + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**spotify_url** | **string** | Spotify Profile URL | [optional] +**youtube_url** | **string** | YouTube channel URL | [optional] +**soundcloud_url** | **string** | SoundCloud Profile URL | [optional] +**tiktok_url** | **string** | TikTok profile URL. For updates, also accepts TikTok usernames | [optional] +**instagram_url** | **string** | Instagram profile URL. For updates, also accepts Instagram usernames | [optional] +**website_url** | **string** | Personnal website URL | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/UserCreation.md b/docs/reference/Model/UserCreation.md new file mode 100644 index 0000000..0fc2b8d --- /dev/null +++ b/docs/reference/Model/UserCreation.md @@ -0,0 +1,15 @@ +# UserCreation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**username** | **string** | Username of the new account | +**firstname** | **string** | First name of the user | [optional] +**lastname** | **string** | Last name of the user | [optional] +**email** | **string** | Email of the new account | [optional] +**password** | **string** | Password of the new account | +**locale** | **string** | User language. Input values will be automatically normalized to a supported locale code. | [optional] [default to 'en'] +**role** | **string** | Role of the new account | [optional] [default to 'user'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/UserDetails.md b/docs/reference/Model/UserDetails.md new file mode 100644 index 0000000..f4d5aff --- /dev/null +++ b/docs/reference/Model/UserDetails.md @@ -0,0 +1,41 @@ +# UserDetails + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The user unique identifier | +**type** | **string** | The type of user account | +**product** | [**\Flat\APIClient\Model\TutteoProduct**](TutteoProduct.md) | | +**username** | **string** | The user name (unique for the organization) | +**printable_name** | **string** | The name that can be directly printed (name, firstname & lastname, or username) | [optional] +**firstname** | **string** | Firstname of the user (for education users) | [optional] +**lastname** | **string** | Lastname of the user (for education users) | [optional] +**name** | **string** | A displayable name for the user (for consumer users) | [optional] +**picture** | **string** | The URL of the picture to display | +**badges** | **string[]** | List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` | [optional] +**organization** | **string** | Organization ID (for Edu users only) | [optional] +**organization_role** | [**\Flat\APIClient\Model\OrganizationRoles**](OrganizationRoles.md) | | [optional] +**class_role** | [**\Flat\APIClient\Model\ClassRoles**](ClassRoles.md) | | [optional] +**html_url** | **string** | Link to user profile (for Indiv. users only) | [optional] +**bio** | **string** | User's biography | [optional] +**registration_date** | **\DateTime** | Date the user signed up | [optional] +**liked_scores_count** | **int** | Number of the scores liked by the user | [optional] +**followers_count** | **int** | Number of followers the user have | [optional] +**following_count** | **int** | Number of people the user follow | [optional] +**owned_public_scores_count** | **int** | Number of public scores the user have | [optional] +**all_public_scores_count** | **int** | Total number of public scores the user participates in (owned + joined) | [optional] +**likes_count** | **int** | Number of likes on the user published scores | [optional] +**plays_count** | **int** | Number of plays on the user published scores | [optional] +**cover_picture** | **string** | Cover picture (backgroud) for the profile | [optional] +**profile_theme** | **string** | Theme (background) for the profile | [optional] +**links** | [**\Flat\APIClient\Model\UserCommunityProfileLinks**](UserCommunityProfileLinks.md) | | [optional] +**is_email_verified** | **bool** | Whether the user's email address has been verified | [optional] +**azure_details** | [**\Flat\APIClient\Model\UserAzureDetails**](UserAzureDetails.md) | | [optional] +**private_profile** | **bool** | Tell either this user profile is private or not (individual accounts only) | [optional] +**locale** | **string** | The user language. Input values will be automatically normalized to a supported locale code. Unknown locales will default to `en`. Current supported locales include: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ja-HIRA`, `ko`, `ms`, `nb`, `nl`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW` | [optional] [default to 'en'] +**groups** | **string[]** | For Flat for Education accounts, list of Group identifiers the user is part of. | [optional] +**picture_file** | **string** | The ID of the user profile picture | [optional] +**cover_picture_file** | **string** | The ID of the user profile cover picture | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/UserDetailsAdmin.md b/docs/reference/Model/UserDetailsAdmin.md new file mode 100644 index 0000000..cd46db4 --- /dev/null +++ b/docs/reference/Model/UserDetailsAdmin.md @@ -0,0 +1,27 @@ +# UserDetailsAdmin + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The user unique identifier | +**type** | **string** | The type of user account | +**product** | [**\Flat\APIClient\Model\TutteoProduct**](TutteoProduct.md) | | +**username** | **string** | The user name (unique for the organization) | +**printable_name** | **string** | The name that can be directly printed (name, firstname & lastname, or username) | [optional] +**firstname** | **string** | Firstname of the user (for education users) | [optional] +**lastname** | **string** | Lastname of the user (for education users) | [optional] +**name** | **string** | A displayable name for the user (for consumer users) | [optional] +**picture** | **string** | The URL of the picture to display | +**badges** | **string[]** | List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` | [optional] +**organization** | **string** | Organization ID (for Edu users only) | [optional] +**organization_role** | [**\Flat\APIClient\Model\OrganizationRoles**](OrganizationRoles.md) | | [optional] +**class_role** | [**\Flat\APIClient\Model\ClassRoles**](ClassRoles.md) | | [optional] +**html_url** | **string** | Link to user profile (for Indiv. users only) | [optional] +**email** | **string** | Email of the user | [optional] +**last_activity_date** | **\DateTime** | Date of the last user activity | [optional] +**license** | [**\Flat\APIClient\Model\UserDetailsAdminAllOfLicense**](UserDetailsAdminAllOfLicense.md) | | [optional] +**groups** | **string[]** | For Flat for Education accounts, list of Group identifiers the user is part of. | [optional] +**is_edu_testing_student** | **bool** | Indicates if the user account is marked as a testing student account. Testing students are typically excluded from certain educational integrations and workflows. This field helps API clients distinguish between regular students and testing accounts. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/UserDetailsAdminAllOfLicense.md b/docs/reference/Model/UserDetailsAdminAllOfLicense.md new file mode 100644 index 0000000..9e10cd6 --- /dev/null +++ b/docs/reference/Model/UserDetailsAdminAllOfLicense.md @@ -0,0 +1,13 @@ +# UserDetailsAdminAllOfLicense + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | ID of the current license | [optional] +**expiration_date** | **\DateTime** | Date when the license expires | [optional] +**source** | [**\Flat\APIClient\Model\LicenseSources**](LicenseSources.md) | | [optional] +**mode** | [**\Flat\APIClient\Model\LicenseMode**](LicenseMode.md) | | [optional] +**active** | **bool** | ID of the current license | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/UserPublic.md b/docs/reference/Model/UserPublic.md new file mode 100644 index 0000000..25591af --- /dev/null +++ b/docs/reference/Model/UserPublic.md @@ -0,0 +1,34 @@ +# UserPublic + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The user unique identifier | +**type** | **string** | The type of user account | +**product** | [**\Flat\APIClient\Model\TutteoProduct**](TutteoProduct.md) | | +**username** | **string** | The user name (unique for the organization) | +**printable_name** | **string** | The name that can be directly printed (name, firstname & lastname, or username) | [optional] +**firstname** | **string** | Firstname of the user (for education users) | [optional] +**lastname** | **string** | Lastname of the user (for education users) | [optional] +**name** | **string** | A displayable name for the user (for consumer users) | [optional] +**picture** | **string** | The URL of the picture to display | +**badges** | **string[]** | List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` | [optional] +**organization** | **string** | Organization ID (for Edu users only) | [optional] +**organization_role** | [**\Flat\APIClient\Model\OrganizationRoles**](OrganizationRoles.md) | | [optional] +**class_role** | [**\Flat\APIClient\Model\ClassRoles**](ClassRoles.md) | | [optional] +**html_url** | **string** | Link to user profile (for Indiv. users only) | [optional] +**bio** | **string** | User's biography | [optional] +**registration_date** | **\DateTime** | Date the user signed up | [optional] +**liked_scores_count** | **int** | Number of the scores liked by the user | [optional] +**followers_count** | **int** | Number of followers the user have | [optional] +**following_count** | **int** | Number of people the user follow | [optional] +**owned_public_scores_count** | **int** | Number of public scores the user have | [optional] +**all_public_scores_count** | **int** | Total number of public scores the user participates in (owned + joined) | [optional] +**likes_count** | **int** | Number of likes on the user published scores | [optional] +**plays_count** | **int** | Number of plays on the user published scores | [optional] +**cover_picture** | **string** | Cover picture (backgroud) for the profile | [optional] +**profile_theme** | **string** | Theme (background) for the profile | [optional] +**links** | [**\Flat\APIClient\Model\UserCommunityProfileLinks**](UserCommunityProfileLinks.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/UserPublicSummary.md b/docs/reference/Model/UserPublicSummary.md new file mode 100644 index 0000000..6e9d3c6 --- /dev/null +++ b/docs/reference/Model/UserPublicSummary.md @@ -0,0 +1,22 @@ +# UserPublicSummary + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The user unique identifier | +**type** | **string** | The type of user account | +**product** | [**\Flat\APIClient\Model\TutteoProduct**](TutteoProduct.md) | | +**username** | **string** | The user name (unique for the organization) | +**printable_name** | **string** | The name that can be directly printed (name, firstname & lastname, or username) | [optional] +**firstname** | **string** | Firstname of the user (for education users) | [optional] +**lastname** | **string** | Lastname of the user (for education users) | [optional] +**name** | **string** | A displayable name for the user (for consumer users) | [optional] +**picture** | **string** | The URL of the picture to display | +**badges** | **string[]** | List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` | [optional] +**organization** | **string** | Organization ID (for Edu users only) | [optional] +**organization_role** | [**\Flat\APIClient\Model\OrganizationRoles**](OrganizationRoles.md) | | [optional] +**class_role** | [**\Flat\APIClient\Model\ClassRoles**](ClassRoles.md) | | [optional] +**html_url** | **string** | Link to user profile (for Indiv. users only) | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/UserSigninLink.md b/docs/reference/Model/UserSigninLink.md new file mode 100644 index 0000000..60104a1 --- /dev/null +++ b/docs/reference/Model/UserSigninLink.md @@ -0,0 +1,11 @@ +# UserSigninLink + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**url** | **string** | URL to use to sign in to this account | [optional] +**token** | **string** | Raw sign-in token, can be used to build custom URLs (e.g. deep links) | [optional] +**expiration_date** | **\DateTime** | Date when the link expires | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/reference/Model/UserSigninLinkCreation.md b/docs/reference/Model/UserSigninLinkCreation.md new file mode 100644 index 0000000..4f7c04f --- /dev/null +++ b/docs/reference/Model/UserSigninLinkCreation.md @@ -0,0 +1,9 @@ +# UserSigninLinkCreation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**destination_path** | **string** | Path to redirect to after signin | [optional] [default to '/'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/git_push.sh b/git_push.sh deleted file mode 100644 index 11f488a..0000000 --- a/git_push.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 - -if [ "$git_user_id" = "" ]; then - git_user_id="FlatIO" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="api-client-php" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=`git remote` -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' - diff --git a/lib/Api/AccountApi.php b/lib/Api/AccountApi.php deleted file mode 100644 index 4bb7444..0000000 --- a/lib/Api/AccountApi.php +++ /dev/null @@ -1,363 +0,0 @@ -client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation getAuthenticatedUser - * - * Get current user profile - * - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\UserDetails - */ - public function getAuthenticatedUser() - { - list($response) = $this->getAuthenticatedUserWithHttpInfo(); - return $response; - } - - /** - * Operation getAuthenticatedUserWithHttpInfo - * - * Get current user profile - * - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\UserDetails, HTTP status code, HTTP response headers (array of strings) - */ - public function getAuthenticatedUserWithHttpInfo() - { - $returnType = '\Flat\APIClient\Model\UserDetails'; - $request = $this->getAuthenticatedUserRequest(); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\UserDetails', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getAuthenticatedUserAsync - * - * Get current user profile - * - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getAuthenticatedUserAsync() - { - return $this->getAuthenticatedUserAsyncWithHttpInfo() - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getAuthenticatedUserAsyncWithHttpInfo - * - * Get current user profile - * - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getAuthenticatedUserAsyncWithHttpInfo() - { - $returnType = '\Flat\APIClient\Model\UserDetails'; - $request = $this->getAuthenticatedUserRequest(); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getAuthenticatedUser' - * - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getAuthenticatedUserRequest() - { - - $resourcePath = '/me'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/lib/Api/ClassApi.php b/lib/Api/ClassApi.php deleted file mode 100644 index 29f9c22..0000000 --- a/lib/Api/ClassApi.php +++ /dev/null @@ -1,5481 +0,0 @@ -client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation activateClass - * - * Activate the class - * - * @param string $class Unique identifier of the class (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ClassDetails - */ - public function activateClass($class) - { - list($response) = $this->activateClassWithHttpInfo($class); - return $response; - } - - /** - * Operation activateClassWithHttpInfo - * - * Activate the class - * - * @param string $class Unique identifier of the class (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ClassDetails, HTTP status code, HTTP response headers (array of strings) - */ - public function activateClassWithHttpInfo($class) - { - $returnType = '\Flat\APIClient\Model\ClassDetails'; - $request = $this->activateClassRequest($class); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ClassDetails', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation activateClassAsync - * - * Activate the class - * - * @param string $class Unique identifier of the class (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function activateClassAsync($class) - { - return $this->activateClassAsyncWithHttpInfo($class) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation activateClassAsyncWithHttpInfo - * - * Activate the class - * - * @param string $class Unique identifier of the class (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function activateClassAsyncWithHttpInfo($class) - { - $returnType = '\Flat\APIClient\Model\ClassDetails'; - $request = $this->activateClassRequest($class); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'activateClass' - * - * @param string $class Unique identifier of the class (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function activateClassRequest($class) - { - // verify the required parameter 'class' is set - if ($class === null || (is_array($class) && count($class) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $class when calling activateClass' - ); - } - - $resourcePath = '/classes/{class}/activate'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($class !== null) { - $resourcePath = str_replace( - '{' . 'class' . '}', - ObjectSerializer::toPathValue($class), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation addClassUser - * - * Add a user to the class - * - * @param string $class Unique identifier of the class (required) - * @param string $user Unique identifier of the user (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function addClassUser($class, $user) - { - $this->addClassUserWithHttpInfo($class, $user); - } - - /** - * Operation addClassUserWithHttpInfo - * - * Add a user to the class - * - * @param string $class Unique identifier of the class (required) - * @param string $user Unique identifier of the user (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function addClassUserWithHttpInfo($class, $user) - { - $returnType = ''; - $request = $this->addClassUserRequest($class, $user); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation addClassUserAsync - * - * Add a user to the class - * - * @param string $class Unique identifier of the class (required) - * @param string $user Unique identifier of the user (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function addClassUserAsync($class, $user) - { - return $this->addClassUserAsyncWithHttpInfo($class, $user) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation addClassUserAsyncWithHttpInfo - * - * Add a user to the class - * - * @param string $class Unique identifier of the class (required) - * @param string $user Unique identifier of the user (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function addClassUserAsyncWithHttpInfo($class, $user) - { - $returnType = ''; - $request = $this->addClassUserRequest($class, $user); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'addClassUser' - * - * @param string $class Unique identifier of the class (required) - * @param string $user Unique identifier of the user (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function addClassUserRequest($class, $user) - { - // verify the required parameter 'class' is set - if ($class === null || (is_array($class) && count($class) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $class when calling addClassUser' - ); - } - // verify the required parameter 'user' is set - if ($user === null || (is_array($user) && count($user) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $user when calling addClassUser' - ); - } - - $resourcePath = '/classes/{class}/users/{user}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($class !== null) { - $resourcePath = str_replace( - '{' . 'class' . '}', - ObjectSerializer::toPathValue($class), - $resourcePath - ); - } - // path params - if ($user !== null) { - $resourcePath = str_replace( - '{' . 'user' . '}', - ObjectSerializer::toPathValue($user), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation archiveClass - * - * Archive the class - * - * @param string $class Unique identifier of the class (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ClassDetails - */ - public function archiveClass($class) - { - list($response) = $this->archiveClassWithHttpInfo($class); - return $response; - } - - /** - * Operation archiveClassWithHttpInfo - * - * Archive the class - * - * @param string $class Unique identifier of the class (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ClassDetails, HTTP status code, HTTP response headers (array of strings) - */ - public function archiveClassWithHttpInfo($class) - { - $returnType = '\Flat\APIClient\Model\ClassDetails'; - $request = $this->archiveClassRequest($class); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ClassDetails', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation archiveClassAsync - * - * Archive the class - * - * @param string $class Unique identifier of the class (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function archiveClassAsync($class) - { - return $this->archiveClassAsyncWithHttpInfo($class) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation archiveClassAsyncWithHttpInfo - * - * Archive the class - * - * @param string $class Unique identifier of the class (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function archiveClassAsyncWithHttpInfo($class) - { - $returnType = '\Flat\APIClient\Model\ClassDetails'; - $request = $this->archiveClassRequest($class); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'archiveClass' - * - * @param string $class Unique identifier of the class (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function archiveClassRequest($class) - { - // verify the required parameter 'class' is set - if ($class === null || (is_array($class) && count($class) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $class when calling archiveClass' - ); - } - - $resourcePath = '/classes/{class}/archive'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($class !== null) { - $resourcePath = str_replace( - '{' . 'class' . '}', - ObjectSerializer::toPathValue($class), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation copyAssignment - * - * Copy an assignment - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * @param \Flat\APIClient\Model\AssignmentCopy $body body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\Assignment - */ - public function copyAssignment($class, $assignment, $body) - { - list($response) = $this->copyAssignmentWithHttpInfo($class, $assignment, $body); - return $response; - } - - /** - * Operation copyAssignmentWithHttpInfo - * - * Copy an assignment - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * @param \Flat\APIClient\Model\AssignmentCopy $body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\Assignment, HTTP status code, HTTP response headers (array of strings) - */ - public function copyAssignmentWithHttpInfo($class, $assignment, $body) - { - $returnType = '\Flat\APIClient\Model\Assignment'; - $request = $this->copyAssignmentRequest($class, $assignment, $body); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\Assignment', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation copyAssignmentAsync - * - * Copy an assignment - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * @param \Flat\APIClient\Model\AssignmentCopy $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function copyAssignmentAsync($class, $assignment, $body) - { - return $this->copyAssignmentAsyncWithHttpInfo($class, $assignment, $body) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation copyAssignmentAsyncWithHttpInfo - * - * Copy an assignment - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * @param \Flat\APIClient\Model\AssignmentCopy $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function copyAssignmentAsyncWithHttpInfo($class, $assignment, $body) - { - $returnType = '\Flat\APIClient\Model\Assignment'; - $request = $this->copyAssignmentRequest($class, $assignment, $body); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'copyAssignment' - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * @param \Flat\APIClient\Model\AssignmentCopy $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function copyAssignmentRequest($class, $assignment, $body) - { - // verify the required parameter 'class' is set - if ($class === null || (is_array($class) && count($class) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $class when calling copyAssignment' - ); - } - // verify the required parameter 'assignment' is set - if ($assignment === null || (is_array($assignment) && count($assignment) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $assignment when calling copyAssignment' - ); - } - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling copyAssignment' - ); - } - - $resourcePath = '/classes/{class}/assignments/{assignment}/copy'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($class !== null) { - $resourcePath = str_replace( - '{' . 'class' . '}', - ObjectSerializer::toPathValue($class), - $resourcePath - ); - } - // path params - if ($assignment !== null) { - $resourcePath = str_replace( - '{' . 'assignment' . '}', - ObjectSerializer::toPathValue($assignment), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation createAssignment - * - * Assignment creation - * - * @param string $class Unique identifier of the class (required) - * @param \Flat\APIClient\Model\AssignmentCreation $body body (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\Assignment - */ - public function createAssignment($class, $body = null) - { - list($response) = $this->createAssignmentWithHttpInfo($class, $body); - return $response; - } - - /** - * Operation createAssignmentWithHttpInfo - * - * Assignment creation - * - * @param string $class Unique identifier of the class (required) - * @param \Flat\APIClient\Model\AssignmentCreation $body (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\Assignment, HTTP status code, HTTP response headers (array of strings) - */ - public function createAssignmentWithHttpInfo($class, $body = null) - { - $returnType = '\Flat\APIClient\Model\Assignment'; - $request = $this->createAssignmentRequest($class, $body); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\Assignment', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation createAssignmentAsync - * - * Assignment creation - * - * @param string $class Unique identifier of the class (required) - * @param \Flat\APIClient\Model\AssignmentCreation $body (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createAssignmentAsync($class, $body = null) - { - return $this->createAssignmentAsyncWithHttpInfo($class, $body) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createAssignmentAsyncWithHttpInfo - * - * Assignment creation - * - * @param string $class Unique identifier of the class (required) - * @param \Flat\APIClient\Model\AssignmentCreation $body (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createAssignmentAsyncWithHttpInfo($class, $body = null) - { - $returnType = '\Flat\APIClient\Model\Assignment'; - $request = $this->createAssignmentRequest($class, $body); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'createAssignment' - * - * @param string $class Unique identifier of the class (required) - * @param \Flat\APIClient\Model\AssignmentCreation $body (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function createAssignmentRequest($class, $body = null) - { - // verify the required parameter 'class' is set - if ($class === null || (is_array($class) && count($class) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $class when calling createAssignment' - ); - } - - $resourcePath = '/classes/{class}/assignments'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($class !== null) { - $resourcePath = str_replace( - '{' . 'class' . '}', - ObjectSerializer::toPathValue($class), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation createClass - * - * Create a new class - * - * @param \Flat\APIClient\Model\ClassCreation $body body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ClassDetails - */ - public function createClass($body) - { - list($response) = $this->createClassWithHttpInfo($body); - return $response; - } - - /** - * Operation createClassWithHttpInfo - * - * Create a new class - * - * @param \Flat\APIClient\Model\ClassCreation $body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ClassDetails, HTTP status code, HTTP response headers (array of strings) - */ - public function createClassWithHttpInfo($body) - { - $returnType = '\Flat\APIClient\Model\ClassDetails'; - $request = $this->createClassRequest($body); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ClassDetails', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 402: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation createClassAsync - * - * Create a new class - * - * @param \Flat\APIClient\Model\ClassCreation $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createClassAsync($body) - { - return $this->createClassAsyncWithHttpInfo($body) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createClassAsyncWithHttpInfo - * - * Create a new class - * - * @param \Flat\APIClient\Model\ClassCreation $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createClassAsyncWithHttpInfo($body) - { - $returnType = '\Flat\APIClient\Model\ClassDetails'; - $request = $this->createClassRequest($body); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'createClass' - * - * @param \Flat\APIClient\Model\ClassCreation $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function createClassRequest($body) - { - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling createClass' - ); - } - - $resourcePath = '/classes'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation createSubmission - * - * Create or edit a submission - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * @param \Flat\APIClient\Model\AssignmentSubmissionUpdate $body body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\AssignmentSubmission - */ - public function createSubmission($class, $assignment, $body) - { - list($response) = $this->createSubmissionWithHttpInfo($class, $assignment, $body); - return $response; - } - - /** - * Operation createSubmissionWithHttpInfo - * - * Create or edit a submission - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * @param \Flat\APIClient\Model\AssignmentSubmissionUpdate $body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\AssignmentSubmission, HTTP status code, HTTP response headers (array of strings) - */ - public function createSubmissionWithHttpInfo($class, $assignment, $body) - { - $returnType = '\Flat\APIClient\Model\AssignmentSubmission'; - $request = $this->createSubmissionRequest($class, $assignment, $body); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\AssignmentSubmission', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation createSubmissionAsync - * - * Create or edit a submission - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * @param \Flat\APIClient\Model\AssignmentSubmissionUpdate $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createSubmissionAsync($class, $assignment, $body) - { - return $this->createSubmissionAsyncWithHttpInfo($class, $assignment, $body) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createSubmissionAsyncWithHttpInfo - * - * Create or edit a submission - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * @param \Flat\APIClient\Model\AssignmentSubmissionUpdate $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createSubmissionAsyncWithHttpInfo($class, $assignment, $body) - { - $returnType = '\Flat\APIClient\Model\AssignmentSubmission'; - $request = $this->createSubmissionRequest($class, $assignment, $body); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'createSubmission' - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * @param \Flat\APIClient\Model\AssignmentSubmissionUpdate $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function createSubmissionRequest($class, $assignment, $body) - { - // verify the required parameter 'class' is set - if ($class === null || (is_array($class) && count($class) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $class when calling createSubmission' - ); - } - // verify the required parameter 'assignment' is set - if ($assignment === null || (is_array($assignment) && count($assignment) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $assignment when calling createSubmission' - ); - } - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling createSubmission' - ); - } - - $resourcePath = '/classes/{class}/assignments/{assignment}/submissions'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($class !== null) { - $resourcePath = str_replace( - '{' . 'class' . '}', - ObjectSerializer::toPathValue($class), - $resourcePath - ); - } - // path params - if ($assignment !== null) { - $resourcePath = str_replace( - '{' . 'assignment' . '}', - ObjectSerializer::toPathValue($assignment), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation deleteClassUser - * - * Remove a user from the class - * - * @param string $class Unique identifier of the class (required) - * @param string $user Unique identifier of the user (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function deleteClassUser($class, $user) - { - $this->deleteClassUserWithHttpInfo($class, $user); - } - - /** - * Operation deleteClassUserWithHttpInfo - * - * Remove a user from the class - * - * @param string $class Unique identifier of the class (required) - * @param string $user Unique identifier of the user (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function deleteClassUserWithHttpInfo($class, $user) - { - $returnType = ''; - $request = $this->deleteClassUserRequest($class, $user); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deleteClassUserAsync - * - * Remove a user from the class - * - * @param string $class Unique identifier of the class (required) - * @param string $user Unique identifier of the user (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteClassUserAsync($class, $user) - { - return $this->deleteClassUserAsyncWithHttpInfo($class, $user) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation deleteClassUserAsyncWithHttpInfo - * - * Remove a user from the class - * - * @param string $class Unique identifier of the class (required) - * @param string $user Unique identifier of the user (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteClassUserAsyncWithHttpInfo($class, $user) - { - $returnType = ''; - $request = $this->deleteClassUserRequest($class, $user); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'deleteClassUser' - * - * @param string $class Unique identifier of the class (required) - * @param string $user Unique identifier of the user (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function deleteClassUserRequest($class, $user) - { - // verify the required parameter 'class' is set - if ($class === null || (is_array($class) && count($class) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $class when calling deleteClassUser' - ); - } - // verify the required parameter 'user' is set - if ($user === null || (is_array($user) && count($user) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $user when calling deleteClassUser' - ); - } - - $resourcePath = '/classes/{class}/users/{user}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($class !== null) { - $resourcePath = str_replace( - '{' . 'class' . '}', - ObjectSerializer::toPathValue($class), - $resourcePath - ); - } - // path params - if ($user !== null) { - $resourcePath = str_replace( - '{' . 'user' . '}', - ObjectSerializer::toPathValue($user), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation editSubmission - * - * Edit a submission - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * @param string $submission Unique identifier of the submission (required) - * @param \Flat\APIClient\Model\AssignmentSubmissionUpdate $body body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\AssignmentSubmission - */ - public function editSubmission($class, $assignment, $submission, $body) - { - list($response) = $this->editSubmissionWithHttpInfo($class, $assignment, $submission, $body); - return $response; - } - - /** - * Operation editSubmissionWithHttpInfo - * - * Edit a submission - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * @param string $submission Unique identifier of the submission (required) - * @param \Flat\APIClient\Model\AssignmentSubmissionUpdate $body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\AssignmentSubmission, HTTP status code, HTTP response headers (array of strings) - */ - public function editSubmissionWithHttpInfo($class, $assignment, $submission, $body) - { - $returnType = '\Flat\APIClient\Model\AssignmentSubmission'; - $request = $this->editSubmissionRequest($class, $assignment, $submission, $body); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\AssignmentSubmission', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation editSubmissionAsync - * - * Edit a submission - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * @param string $submission Unique identifier of the submission (required) - * @param \Flat\APIClient\Model\AssignmentSubmissionUpdate $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function editSubmissionAsync($class, $assignment, $submission, $body) - { - return $this->editSubmissionAsyncWithHttpInfo($class, $assignment, $submission, $body) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation editSubmissionAsyncWithHttpInfo - * - * Edit a submission - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * @param string $submission Unique identifier of the submission (required) - * @param \Flat\APIClient\Model\AssignmentSubmissionUpdate $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function editSubmissionAsyncWithHttpInfo($class, $assignment, $submission, $body) - { - $returnType = '\Flat\APIClient\Model\AssignmentSubmission'; - $request = $this->editSubmissionRequest($class, $assignment, $submission, $body); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'editSubmission' - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * @param string $submission Unique identifier of the submission (required) - * @param \Flat\APIClient\Model\AssignmentSubmissionUpdate $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function editSubmissionRequest($class, $assignment, $submission, $body) - { - // verify the required parameter 'class' is set - if ($class === null || (is_array($class) && count($class) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $class when calling editSubmission' - ); - } - // verify the required parameter 'assignment' is set - if ($assignment === null || (is_array($assignment) && count($assignment) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $assignment when calling editSubmission' - ); - } - // verify the required parameter 'submission' is set - if ($submission === null || (is_array($submission) && count($submission) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $submission when calling editSubmission' - ); - } - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling editSubmission' - ); - } - - $resourcePath = '/classes/{class}/assignments/{assignment}/submissions/{submission}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($class !== null) { - $resourcePath = str_replace( - '{' . 'class' . '}', - ObjectSerializer::toPathValue($class), - $resourcePath - ); - } - // path params - if ($assignment !== null) { - $resourcePath = str_replace( - '{' . 'assignment' . '}', - ObjectSerializer::toPathValue($assignment), - $resourcePath - ); - } - // path params - if ($submission !== null) { - $resourcePath = str_replace( - '{' . 'submission' . '}', - ObjectSerializer::toPathValue($submission), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation enrollClass - * - * Join a class - * - * @param string $enrollmentCode The enrollment code, available to the teacher in `ClassDetails` (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ClassDetails - */ - public function enrollClass($enrollmentCode) - { - list($response) = $this->enrollClassWithHttpInfo($enrollmentCode); - return $response; - } - - /** - * Operation enrollClassWithHttpInfo - * - * Join a class - * - * @param string $enrollmentCode The enrollment code, available to the teacher in `ClassDetails` (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ClassDetails, HTTP status code, HTTP response headers (array of strings) - */ - public function enrollClassWithHttpInfo($enrollmentCode) - { - $returnType = '\Flat\APIClient\Model\ClassDetails'; - $request = $this->enrollClassRequest($enrollmentCode); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ClassDetails', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation enrollClassAsync - * - * Join a class - * - * @param string $enrollmentCode The enrollment code, available to the teacher in `ClassDetails` (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function enrollClassAsync($enrollmentCode) - { - return $this->enrollClassAsyncWithHttpInfo($enrollmentCode) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation enrollClassAsyncWithHttpInfo - * - * Join a class - * - * @param string $enrollmentCode The enrollment code, available to the teacher in `ClassDetails` (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function enrollClassAsyncWithHttpInfo($enrollmentCode) - { - $returnType = '\Flat\APIClient\Model\ClassDetails'; - $request = $this->enrollClassRequest($enrollmentCode); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'enrollClass' - * - * @param string $enrollmentCode The enrollment code, available to the teacher in `ClassDetails` (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function enrollClassRequest($enrollmentCode) - { - // verify the required parameter 'enrollmentCode' is set - if ($enrollmentCode === null || (is_array($enrollmentCode) && count($enrollmentCode) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $enrollmentCode when calling enrollClass' - ); - } - - $resourcePath = '/classes/enroll/{enrollmentCode}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($enrollmentCode !== null) { - $resourcePath = str_replace( - '{' . 'enrollmentCode' . '}', - ObjectSerializer::toPathValue($enrollmentCode), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getClass - * - * Get the details of a single class - * - * @param string $class Unique identifier of the class (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ClassDetails - */ - public function getClass($class) - { - list($response) = $this->getClassWithHttpInfo($class); - return $response; - } - - /** - * Operation getClassWithHttpInfo - * - * Get the details of a single class - * - * @param string $class Unique identifier of the class (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ClassDetails, HTTP status code, HTTP response headers (array of strings) - */ - public function getClassWithHttpInfo($class) - { - $returnType = '\Flat\APIClient\Model\ClassDetails'; - $request = $this->getClassRequest($class); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ClassDetails', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getClassAsync - * - * Get the details of a single class - * - * @param string $class Unique identifier of the class (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getClassAsync($class) - { - return $this->getClassAsyncWithHttpInfo($class) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getClassAsyncWithHttpInfo - * - * Get the details of a single class - * - * @param string $class Unique identifier of the class (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getClassAsyncWithHttpInfo($class) - { - $returnType = '\Flat\APIClient\Model\ClassDetails'; - $request = $this->getClassRequest($class); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getClass' - * - * @param string $class Unique identifier of the class (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getClassRequest($class) - { - // verify the required parameter 'class' is set - if ($class === null || (is_array($class) && count($class) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $class when calling getClass' - ); - } - - $resourcePath = '/classes/{class}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($class !== null) { - $resourcePath = str_replace( - '{' . 'class' . '}', - ObjectSerializer::toPathValue($class), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getScoreSubmissions - * - * List submissions related to the score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\AssignmentSubmission[] - */ - public function getScoreSubmissions($score) - { - list($response) = $this->getScoreSubmissionsWithHttpInfo($score); - return $response; - } - - /** - * Operation getScoreSubmissionsWithHttpInfo - * - * List submissions related to the score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\AssignmentSubmission[], HTTP status code, HTTP response headers (array of strings) - */ - public function getScoreSubmissionsWithHttpInfo($score) - { - $returnType = '\Flat\APIClient\Model\AssignmentSubmission[]'; - $request = $this->getScoreSubmissionsRequest($score); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\AssignmentSubmission[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getScoreSubmissionsAsync - * - * List submissions related to the score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getScoreSubmissionsAsync($score) - { - return $this->getScoreSubmissionsAsyncWithHttpInfo($score) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getScoreSubmissionsAsyncWithHttpInfo - * - * List submissions related to the score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getScoreSubmissionsAsyncWithHttpInfo($score) - { - $returnType = '\Flat\APIClient\Model\AssignmentSubmission[]'; - $request = $this->getScoreSubmissionsRequest($score); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getScoreSubmissions' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getScoreSubmissionsRequest($score) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling getScoreSubmissions' - ); - } - - $resourcePath = '/scores/{score}/submissions'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getSubmission - * - * Get a student submission - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * @param string $submission Unique identifier of the submission (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\AssignmentSubmission - */ - public function getSubmission($class, $assignment, $submission) - { - list($response) = $this->getSubmissionWithHttpInfo($class, $assignment, $submission); - return $response; - } - - /** - * Operation getSubmissionWithHttpInfo - * - * Get a student submission - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * @param string $submission Unique identifier of the submission (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\AssignmentSubmission, HTTP status code, HTTP response headers (array of strings) - */ - public function getSubmissionWithHttpInfo($class, $assignment, $submission) - { - $returnType = '\Flat\APIClient\Model\AssignmentSubmission'; - $request = $this->getSubmissionRequest($class, $assignment, $submission); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\AssignmentSubmission', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getSubmissionAsync - * - * Get a student submission - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * @param string $submission Unique identifier of the submission (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getSubmissionAsync($class, $assignment, $submission) - { - return $this->getSubmissionAsyncWithHttpInfo($class, $assignment, $submission) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getSubmissionAsyncWithHttpInfo - * - * Get a student submission - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * @param string $submission Unique identifier of the submission (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getSubmissionAsyncWithHttpInfo($class, $assignment, $submission) - { - $returnType = '\Flat\APIClient\Model\AssignmentSubmission'; - $request = $this->getSubmissionRequest($class, $assignment, $submission); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getSubmission' - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * @param string $submission Unique identifier of the submission (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getSubmissionRequest($class, $assignment, $submission) - { - // verify the required parameter 'class' is set - if ($class === null || (is_array($class) && count($class) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $class when calling getSubmission' - ); - } - // verify the required parameter 'assignment' is set - if ($assignment === null || (is_array($assignment) && count($assignment) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $assignment when calling getSubmission' - ); - } - // verify the required parameter 'submission' is set - if ($submission === null || (is_array($submission) && count($submission) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $submission when calling getSubmission' - ); - } - - $resourcePath = '/classes/{class}/assignments/{assignment}/submissions/{submission}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($class !== null) { - $resourcePath = str_replace( - '{' . 'class' . '}', - ObjectSerializer::toPathValue($class), - $resourcePath - ); - } - // path params - if ($assignment !== null) { - $resourcePath = str_replace( - '{' . 'assignment' . '}', - ObjectSerializer::toPathValue($assignment), - $resourcePath - ); - } - // path params - if ($submission !== null) { - $resourcePath = str_replace( - '{' . 'submission' . '}', - ObjectSerializer::toPathValue($submission), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getSubmissions - * - * List the students' submissions - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\AssignmentSubmission[] - */ - public function getSubmissions($class, $assignment) - { - list($response) = $this->getSubmissionsWithHttpInfo($class, $assignment); - return $response; - } - - /** - * Operation getSubmissionsWithHttpInfo - * - * List the students' submissions - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\AssignmentSubmission[], HTTP status code, HTTP response headers (array of strings) - */ - public function getSubmissionsWithHttpInfo($class, $assignment) - { - $returnType = '\Flat\APIClient\Model\AssignmentSubmission[]'; - $request = $this->getSubmissionsRequest($class, $assignment); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\AssignmentSubmission[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getSubmissionsAsync - * - * List the students' submissions - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getSubmissionsAsync($class, $assignment) - { - return $this->getSubmissionsAsyncWithHttpInfo($class, $assignment) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getSubmissionsAsyncWithHttpInfo - * - * List the students' submissions - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getSubmissionsAsyncWithHttpInfo($class, $assignment) - { - $returnType = '\Flat\APIClient\Model\AssignmentSubmission[]'; - $request = $this->getSubmissionsRequest($class, $assignment); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getSubmissions' - * - * @param string $class Unique identifier of the class (required) - * @param string $assignment Unique identifier of the assignment (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getSubmissionsRequest($class, $assignment) - { - // verify the required parameter 'class' is set - if ($class === null || (is_array($class) && count($class) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $class when calling getSubmissions' - ); - } - // verify the required parameter 'assignment' is set - if ($assignment === null || (is_array($assignment) && count($assignment) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $assignment when calling getSubmissions' - ); - } - - $resourcePath = '/classes/{class}/assignments/{assignment}/submissions'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($class !== null) { - $resourcePath = str_replace( - '{' . 'class' . '}', - ObjectSerializer::toPathValue($class), - $resourcePath - ); - } - // path params - if ($assignment !== null) { - $resourcePath = str_replace( - '{' . 'assignment' . '}', - ObjectSerializer::toPathValue($assignment), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation listAssignments - * - * Assignments listing - * - * @param string $class Unique identifier of the class (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\Assignment[] - */ - public function listAssignments($class) - { - list($response) = $this->listAssignmentsWithHttpInfo($class); - return $response; - } - - /** - * Operation listAssignmentsWithHttpInfo - * - * Assignments listing - * - * @param string $class Unique identifier of the class (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\Assignment[], HTTP status code, HTTP response headers (array of strings) - */ - public function listAssignmentsWithHttpInfo($class) - { - $returnType = '\Flat\APIClient\Model\Assignment[]'; - $request = $this->listAssignmentsRequest($class); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\Assignment[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation listAssignmentsAsync - * - * Assignments listing - * - * @param string $class Unique identifier of the class (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function listAssignmentsAsync($class) - { - return $this->listAssignmentsAsyncWithHttpInfo($class) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation listAssignmentsAsyncWithHttpInfo - * - * Assignments listing - * - * @param string $class Unique identifier of the class (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function listAssignmentsAsyncWithHttpInfo($class) - { - $returnType = '\Flat\APIClient\Model\Assignment[]'; - $request = $this->listAssignmentsRequest($class); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'listAssignments' - * - * @param string $class Unique identifier of the class (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function listAssignmentsRequest($class) - { - // verify the required parameter 'class' is set - if ($class === null || (is_array($class) && count($class) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $class when calling listAssignments' - ); - } - - $resourcePath = '/classes/{class}/assignments'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($class !== null) { - $resourcePath = str_replace( - '{' . 'class' . '}', - ObjectSerializer::toPathValue($class), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation listClassStudentSubmissions - * - * List the submissions for a student - * - * @param string $class Unique identifier of the class (required) - * @param string $user Unique identifier of the user (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\AssignmentSubmission[] - */ - public function listClassStudentSubmissions($class, $user) - { - list($response) = $this->listClassStudentSubmissionsWithHttpInfo($class, $user); - return $response; - } - - /** - * Operation listClassStudentSubmissionsWithHttpInfo - * - * List the submissions for a student - * - * @param string $class Unique identifier of the class (required) - * @param string $user Unique identifier of the user (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\AssignmentSubmission[], HTTP status code, HTTP response headers (array of strings) - */ - public function listClassStudentSubmissionsWithHttpInfo($class, $user) - { - $returnType = '\Flat\APIClient\Model\AssignmentSubmission[]'; - $request = $this->listClassStudentSubmissionsRequest($class, $user); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\AssignmentSubmission[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation listClassStudentSubmissionsAsync - * - * List the submissions for a student - * - * @param string $class Unique identifier of the class (required) - * @param string $user Unique identifier of the user (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function listClassStudentSubmissionsAsync($class, $user) - { - return $this->listClassStudentSubmissionsAsyncWithHttpInfo($class, $user) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation listClassStudentSubmissionsAsyncWithHttpInfo - * - * List the submissions for a student - * - * @param string $class Unique identifier of the class (required) - * @param string $user Unique identifier of the user (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function listClassStudentSubmissionsAsyncWithHttpInfo($class, $user) - { - $returnType = '\Flat\APIClient\Model\AssignmentSubmission[]'; - $request = $this->listClassStudentSubmissionsRequest($class, $user); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'listClassStudentSubmissions' - * - * @param string $class Unique identifier of the class (required) - * @param string $user Unique identifier of the user (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function listClassStudentSubmissionsRequest($class, $user) - { - // verify the required parameter 'class' is set - if ($class === null || (is_array($class) && count($class) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $class when calling listClassStudentSubmissions' - ); - } - // verify the required parameter 'user' is set - if ($user === null || (is_array($user) && count($user) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $user when calling listClassStudentSubmissions' - ); - } - - $resourcePath = '/classes/{class}/students/{user}/submissions'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($class !== null) { - $resourcePath = str_replace( - '{' . 'class' . '}', - ObjectSerializer::toPathValue($class), - $resourcePath - ); - } - // path params - if ($user !== null) { - $resourcePath = str_replace( - '{' . 'user' . '}', - ObjectSerializer::toPathValue($user), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation listClasses - * - * List the classes available for the current user - * - * @param string $state Filter the classes by state (optional, default to active) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ClassDetails[] - */ - public function listClasses($state = 'active') - { - list($response) = $this->listClassesWithHttpInfo($state); - return $response; - } - - /** - * Operation listClassesWithHttpInfo - * - * List the classes available for the current user - * - * @param string $state Filter the classes by state (optional, default to active) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ClassDetails[], HTTP status code, HTTP response headers (array of strings) - */ - public function listClassesWithHttpInfo($state = 'active') - { - $returnType = '\Flat\APIClient\Model\ClassDetails[]'; - $request = $this->listClassesRequest($state); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ClassDetails[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation listClassesAsync - * - * List the classes available for the current user - * - * @param string $state Filter the classes by state (optional, default to active) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function listClassesAsync($state = 'active') - { - return $this->listClassesAsyncWithHttpInfo($state) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation listClassesAsyncWithHttpInfo - * - * List the classes available for the current user - * - * @param string $state Filter the classes by state (optional, default to active) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function listClassesAsyncWithHttpInfo($state = 'active') - { - $returnType = '\Flat\APIClient\Model\ClassDetails[]'; - $request = $this->listClassesRequest($state); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'listClasses' - * - * @param string $state Filter the classes by state (optional, default to active) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function listClassesRequest($state = 'active') - { - - $resourcePath = '/classes'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($state !== null) { - $queryParams['state'] = ObjectSerializer::toQueryValue($state); - } - - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation unarchiveClass - * - * Unarchive the class - * - * @param string $class Unique identifier of the class (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ClassDetails - */ - public function unarchiveClass($class) - { - list($response) = $this->unarchiveClassWithHttpInfo($class); - return $response; - } - - /** - * Operation unarchiveClassWithHttpInfo - * - * Unarchive the class - * - * @param string $class Unique identifier of the class (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ClassDetails, HTTP status code, HTTP response headers (array of strings) - */ - public function unarchiveClassWithHttpInfo($class) - { - $returnType = '\Flat\APIClient\Model\ClassDetails'; - $request = $this->unarchiveClassRequest($class); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ClassDetails', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation unarchiveClassAsync - * - * Unarchive the class - * - * @param string $class Unique identifier of the class (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function unarchiveClassAsync($class) - { - return $this->unarchiveClassAsyncWithHttpInfo($class) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation unarchiveClassAsyncWithHttpInfo - * - * Unarchive the class - * - * @param string $class Unique identifier of the class (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function unarchiveClassAsyncWithHttpInfo($class) - { - $returnType = '\Flat\APIClient\Model\ClassDetails'; - $request = $this->unarchiveClassRequest($class); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'unarchiveClass' - * - * @param string $class Unique identifier of the class (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function unarchiveClassRequest($class) - { - // verify the required parameter 'class' is set - if ($class === null || (is_array($class) && count($class) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $class when calling unarchiveClass' - ); - } - - $resourcePath = '/classes/{class}/archive'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($class !== null) { - $resourcePath = str_replace( - '{' . 'class' . '}', - ObjectSerializer::toPathValue($class), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation updateClass - * - * Update the class - * - * @param string $class Unique identifier of the class (required) - * @param \Flat\APIClient\Model\ClassUpdate $body Details of the Class (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ClassDetails - */ - public function updateClass($class, $body = null) - { - list($response) = $this->updateClassWithHttpInfo($class, $body); - return $response; - } - - /** - * Operation updateClassWithHttpInfo - * - * Update the class - * - * @param string $class Unique identifier of the class (required) - * @param \Flat\APIClient\Model\ClassUpdate $body Details of the Class (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ClassDetails, HTTP status code, HTTP response headers (array of strings) - */ - public function updateClassWithHttpInfo($class, $body = null) - { - $returnType = '\Flat\APIClient\Model\ClassDetails'; - $request = $this->updateClassRequest($class, $body); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ClassDetails', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation updateClassAsync - * - * Update the class - * - * @param string $class Unique identifier of the class (required) - * @param \Flat\APIClient\Model\ClassUpdate $body Details of the Class (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateClassAsync($class, $body = null) - { - return $this->updateClassAsyncWithHttpInfo($class, $body) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateClassAsyncWithHttpInfo - * - * Update the class - * - * @param string $class Unique identifier of the class (required) - * @param \Flat\APIClient\Model\ClassUpdate $body Details of the Class (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateClassAsyncWithHttpInfo($class, $body = null) - { - $returnType = '\Flat\APIClient\Model\ClassDetails'; - $request = $this->updateClassRequest($class, $body); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'updateClass' - * - * @param string $class Unique identifier of the class (required) - * @param \Flat\APIClient\Model\ClassUpdate $body Details of the Class (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function updateClassRequest($class, $body = null) - { - // verify the required parameter 'class' is set - if ($class === null || (is_array($class) && count($class) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $class when calling updateClass' - ); - } - - $resourcePath = '/classes/{class}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($class !== null) { - $resourcePath = str_replace( - '{' . 'class' . '}', - ObjectSerializer::toPathValue($class), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/lib/Api/CollectionApi.php b/lib/Api/CollectionApi.php deleted file mode 100644 index 7e7d528..0000000 --- a/lib/Api/CollectionApi.php +++ /dev/null @@ -1,2729 +0,0 @@ -client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation addScoreToCollection - * - * Add a score to the collection - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ScoreDetails - */ - public function addScoreToCollection($collection, $score, $sharingKey = null) - { - list($response) = $this->addScoreToCollectionWithHttpInfo($collection, $score, $sharingKey); - return $response; - } - - /** - * Operation addScoreToCollectionWithHttpInfo - * - * Add a score to the collection - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ScoreDetails, HTTP status code, HTTP response headers (array of strings) - */ - public function addScoreToCollectionWithHttpInfo($collection, $score, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails'; - $request = $this->addScoreToCollectionRequest($collection, $score, $sharingKey); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ScoreDetails', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation addScoreToCollectionAsync - * - * Add a score to the collection - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function addScoreToCollectionAsync($collection, $score, $sharingKey = null) - { - return $this->addScoreToCollectionAsyncWithHttpInfo($collection, $score, $sharingKey) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation addScoreToCollectionAsyncWithHttpInfo - * - * Add a score to the collection - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function addScoreToCollectionAsyncWithHttpInfo($collection, $score, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails'; - $request = $this->addScoreToCollectionRequest($collection, $score, $sharingKey); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'addScoreToCollection' - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function addScoreToCollectionRequest($collection, $score, $sharingKey = null) - { - // verify the required parameter 'collection' is set - if ($collection === null || (is_array($collection) && count($collection) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $collection when calling addScoreToCollection' - ); - } - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling addScoreToCollection' - ); - } - - $resourcePath = '/collections/{collection}/scores/{score}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($sharingKey !== null) { - $queryParams['sharingKey'] = ObjectSerializer::toQueryValue($sharingKey); - } - - // path params - if ($collection !== null) { - $resourcePath = str_replace( - '{' . 'collection' . '}', - ObjectSerializer::toPathValue($collection), - $resourcePath - ); - } - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation createCollection - * - * Create a new collection - * - * @param \Flat\APIClient\Model\CollectionCreation $body body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\Collection - */ - public function createCollection($body) - { - list($response) = $this->createCollectionWithHttpInfo($body); - return $response; - } - - /** - * Operation createCollectionWithHttpInfo - * - * Create a new collection - * - * @param \Flat\APIClient\Model\CollectionCreation $body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\Collection, HTTP status code, HTTP response headers (array of strings) - */ - public function createCollectionWithHttpInfo($body) - { - $returnType = '\Flat\APIClient\Model\Collection'; - $request = $this->createCollectionRequest($body); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\Collection', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation createCollectionAsync - * - * Create a new collection - * - * @param \Flat\APIClient\Model\CollectionCreation $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createCollectionAsync($body) - { - return $this->createCollectionAsyncWithHttpInfo($body) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createCollectionAsyncWithHttpInfo - * - * Create a new collection - * - * @param \Flat\APIClient\Model\CollectionCreation $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createCollectionAsyncWithHttpInfo($body) - { - $returnType = '\Flat\APIClient\Model\Collection'; - $request = $this->createCollectionRequest($body); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'createCollection' - * - * @param \Flat\APIClient\Model\CollectionCreation $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function createCollectionRequest($body) - { - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling createCollection' - ); - } - - $resourcePath = '/collections'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation deleteCollection - * - * Delete the collection - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function deleteCollection($collection) - { - $this->deleteCollectionWithHttpInfo($collection); - } - - /** - * Operation deleteCollectionWithHttpInfo - * - * Delete the collection - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function deleteCollectionWithHttpInfo($collection) - { - $returnType = ''; - $request = $this->deleteCollectionRequest($collection); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deleteCollectionAsync - * - * Delete the collection - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteCollectionAsync($collection) - { - return $this->deleteCollectionAsyncWithHttpInfo($collection) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation deleteCollectionAsyncWithHttpInfo - * - * Delete the collection - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteCollectionAsyncWithHttpInfo($collection) - { - $returnType = ''; - $request = $this->deleteCollectionRequest($collection); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'deleteCollection' - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function deleteCollectionRequest($collection) - { - // verify the required parameter 'collection' is set - if ($collection === null || (is_array($collection) && count($collection) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $collection when calling deleteCollection' - ); - } - - $resourcePath = '/collections/{collection}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($collection !== null) { - $resourcePath = str_replace( - '{' . 'collection' . '}', - ObjectSerializer::toPathValue($collection), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation deleteScoreFromCollection - * - * Delete a score from the collection - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function deleteScoreFromCollection($collection, $score) - { - $this->deleteScoreFromCollectionWithHttpInfo($collection, $score); - } - - /** - * Operation deleteScoreFromCollectionWithHttpInfo - * - * Delete a score from the collection - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function deleteScoreFromCollectionWithHttpInfo($collection, $score) - { - $returnType = ''; - $request = $this->deleteScoreFromCollectionRequest($collection, $score); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deleteScoreFromCollectionAsync - * - * Delete a score from the collection - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteScoreFromCollectionAsync($collection, $score) - { - return $this->deleteScoreFromCollectionAsyncWithHttpInfo($collection, $score) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation deleteScoreFromCollectionAsyncWithHttpInfo - * - * Delete a score from the collection - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteScoreFromCollectionAsyncWithHttpInfo($collection, $score) - { - $returnType = ''; - $request = $this->deleteScoreFromCollectionRequest($collection, $score); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'deleteScoreFromCollection' - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function deleteScoreFromCollectionRequest($collection, $score) - { - // verify the required parameter 'collection' is set - if ($collection === null || (is_array($collection) && count($collection) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $collection when calling deleteScoreFromCollection' - ); - } - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling deleteScoreFromCollection' - ); - } - - $resourcePath = '/collections/{collection}/scores/{score}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($collection !== null) { - $resourcePath = str_replace( - '{' . 'collection' . '}', - ObjectSerializer::toPathValue($collection), - $resourcePath - ); - } - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation editCollection - * - * Update a collection's metadata - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param \Flat\APIClient\Model\CollectionModification $body body (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\Collection - */ - public function editCollection($collection, $body = null) - { - list($response) = $this->editCollectionWithHttpInfo($collection, $body); - return $response; - } - - /** - * Operation editCollectionWithHttpInfo - * - * Update a collection's metadata - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param \Flat\APIClient\Model\CollectionModification $body (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\Collection, HTTP status code, HTTP response headers (array of strings) - */ - public function editCollectionWithHttpInfo($collection, $body = null) - { - $returnType = '\Flat\APIClient\Model\Collection'; - $request = $this->editCollectionRequest($collection, $body); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\Collection', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation editCollectionAsync - * - * Update a collection's metadata - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param \Flat\APIClient\Model\CollectionModification $body (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function editCollectionAsync($collection, $body = null) - { - return $this->editCollectionAsyncWithHttpInfo($collection, $body) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation editCollectionAsyncWithHttpInfo - * - * Update a collection's metadata - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param \Flat\APIClient\Model\CollectionModification $body (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function editCollectionAsyncWithHttpInfo($collection, $body = null) - { - $returnType = '\Flat\APIClient\Model\Collection'; - $request = $this->editCollectionRequest($collection, $body); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'editCollection' - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param \Flat\APIClient\Model\CollectionModification $body (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function editCollectionRequest($collection, $body = null) - { - // verify the required parameter 'collection' is set - if ($collection === null || (is_array($collection) && count($collection) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $collection when calling editCollection' - ); - } - - $resourcePath = '/collections/{collection}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($collection !== null) { - $resourcePath = str_replace( - '{' . 'collection' . '}', - ObjectSerializer::toPathValue($collection), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getCollection - * - * Get collection details - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\Collection - */ - public function getCollection($collection, $sharingKey = null) - { - list($response) = $this->getCollectionWithHttpInfo($collection, $sharingKey); - return $response; - } - - /** - * Operation getCollectionWithHttpInfo - * - * Get collection details - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\Collection, HTTP status code, HTTP response headers (array of strings) - */ - public function getCollectionWithHttpInfo($collection, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\Collection'; - $request = $this->getCollectionRequest($collection, $sharingKey); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\Collection', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getCollectionAsync - * - * Get collection details - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getCollectionAsync($collection, $sharingKey = null) - { - return $this->getCollectionAsyncWithHttpInfo($collection, $sharingKey) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getCollectionAsyncWithHttpInfo - * - * Get collection details - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getCollectionAsyncWithHttpInfo($collection, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\Collection'; - $request = $this->getCollectionRequest($collection, $sharingKey); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getCollection' - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getCollectionRequest($collection, $sharingKey = null) - { - // verify the required parameter 'collection' is set - if ($collection === null || (is_array($collection) && count($collection) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $collection when calling getCollection' - ); - } - - $resourcePath = '/collections/{collection}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($sharingKey !== null) { - $queryParams['sharingKey'] = ObjectSerializer::toQueryValue($sharingKey); - } - - // path params - if ($collection !== null) { - $resourcePath = str_replace( - '{' . 'collection' . '}', - ObjectSerializer::toPathValue($collection), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation listCollectionScores - * - * List the scores contained in a collection - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * @param string $sort Sort (optional) - * @param string $direction Sort direction (optional) - * @param int $limit This is the maximum number of objects that may be returned (optional, default to 25) - * @param string $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * @param string $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ScoreDetails[] - */ - public function listCollectionScores($collection, $sharingKey = null, $sort = null, $direction = null, $limit = '25', $next = null, $previous = null) - { - list($response) = $this->listCollectionScoresWithHttpInfo($collection, $sharingKey, $sort, $direction, $limit, $next, $previous); - return $response; - } - - /** - * Operation listCollectionScoresWithHttpInfo - * - * List the scores contained in a collection - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * @param string $sort Sort (optional) - * @param string $direction Sort direction (optional) - * @param int $limit This is the maximum number of objects that may be returned (optional, default to 25) - * @param string $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * @param string $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ScoreDetails[], HTTP status code, HTTP response headers (array of strings) - */ - public function listCollectionScoresWithHttpInfo($collection, $sharingKey = null, $sort = null, $direction = null, $limit = '25', $next = null, $previous = null) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails[]'; - $request = $this->listCollectionScoresRequest($collection, $sharingKey, $sort, $direction, $limit, $next, $previous); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ScoreDetails[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation listCollectionScoresAsync - * - * List the scores contained in a collection - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * @param string $sort Sort (optional) - * @param string $direction Sort direction (optional) - * @param int $limit This is the maximum number of objects that may be returned (optional, default to 25) - * @param string $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * @param string $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function listCollectionScoresAsync($collection, $sharingKey = null, $sort = null, $direction = null, $limit = '25', $next = null, $previous = null) - { - return $this->listCollectionScoresAsyncWithHttpInfo($collection, $sharingKey, $sort, $direction, $limit, $next, $previous) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation listCollectionScoresAsyncWithHttpInfo - * - * List the scores contained in a collection - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * @param string $sort Sort (optional) - * @param string $direction Sort direction (optional) - * @param int $limit This is the maximum number of objects that may be returned (optional, default to 25) - * @param string $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * @param string $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function listCollectionScoresAsyncWithHttpInfo($collection, $sharingKey = null, $sort = null, $direction = null, $limit = '25', $next = null, $previous = null) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails[]'; - $request = $this->listCollectionScoresRequest($collection, $sharingKey, $sort, $direction, $limit, $next, $previous); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'listCollectionScores' - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * @param string $sort Sort (optional) - * @param string $direction Sort direction (optional) - * @param int $limit This is the maximum number of objects that may be returned (optional, default to 25) - * @param string $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * @param string $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function listCollectionScoresRequest($collection, $sharingKey = null, $sort = null, $direction = null, $limit = '25', $next = null, $previous = null) - { - // verify the required parameter 'collection' is set - if ($collection === null || (is_array($collection) && count($collection) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $collection when calling listCollectionScores' - ); - } - if ($limit !== null && $limit > 100) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling CollectionApi.listCollectionScores, must be smaller than or equal to 100.'); - } - if ($limit !== null && $limit < 1) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling CollectionApi.listCollectionScores, must be bigger than or equal to 1.'); - } - - - $resourcePath = '/collections/{collection}/scores'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($sharingKey !== null) { - $queryParams['sharingKey'] = ObjectSerializer::toQueryValue($sharingKey); - } - // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } - // query params - if ($direction !== null) { - $queryParams['direction'] = ObjectSerializer::toQueryValue($direction); - } - // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } - // query params - if ($next !== null) { - $queryParams['next'] = ObjectSerializer::toQueryValue($next); - } - // query params - if ($previous !== null) { - $queryParams['previous'] = ObjectSerializer::toQueryValue($previous); - } - - // path params - if ($collection !== null) { - $resourcePath = str_replace( - '{' . 'collection' . '}', - ObjectSerializer::toPathValue($collection), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation listCollections - * - * List the collections - * - * @param string $parent List the collection contained in this `parent` collection. This option doesn't provide a complete multi-level collection support. When sharing a collection with someone, this one will have as `parent` `sharedWithMe`. (optional, default to root) - * @param string $sort Sort (optional) - * @param string $direction Sort direction (optional) - * @param int $limit This is the maximum number of objects that may be returned (optional, default to 25) - * @param string $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * @param string $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\Collection[] - */ - public function listCollections($parent = 'root', $sort = null, $direction = null, $limit = '25', $next = null, $previous = null) - { - list($response) = $this->listCollectionsWithHttpInfo($parent, $sort, $direction, $limit, $next, $previous); - return $response; - } - - /** - * Operation listCollectionsWithHttpInfo - * - * List the collections - * - * @param string $parent List the collection contained in this `parent` collection. This option doesn't provide a complete multi-level collection support. When sharing a collection with someone, this one will have as `parent` `sharedWithMe`. (optional, default to root) - * @param string $sort Sort (optional) - * @param string $direction Sort direction (optional) - * @param int $limit This is the maximum number of objects that may be returned (optional, default to 25) - * @param string $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * @param string $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\Collection[], HTTP status code, HTTP response headers (array of strings) - */ - public function listCollectionsWithHttpInfo($parent = 'root', $sort = null, $direction = null, $limit = '25', $next = null, $previous = null) - { - $returnType = '\Flat\APIClient\Model\Collection[]'; - $request = $this->listCollectionsRequest($parent, $sort, $direction, $limit, $next, $previous); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\Collection[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation listCollectionsAsync - * - * List the collections - * - * @param string $parent List the collection contained in this `parent` collection. This option doesn't provide a complete multi-level collection support. When sharing a collection with someone, this one will have as `parent` `sharedWithMe`. (optional, default to root) - * @param string $sort Sort (optional) - * @param string $direction Sort direction (optional) - * @param int $limit This is the maximum number of objects that may be returned (optional, default to 25) - * @param string $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * @param string $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function listCollectionsAsync($parent = 'root', $sort = null, $direction = null, $limit = '25', $next = null, $previous = null) - { - return $this->listCollectionsAsyncWithHttpInfo($parent, $sort, $direction, $limit, $next, $previous) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation listCollectionsAsyncWithHttpInfo - * - * List the collections - * - * @param string $parent List the collection contained in this `parent` collection. This option doesn't provide a complete multi-level collection support. When sharing a collection with someone, this one will have as `parent` `sharedWithMe`. (optional, default to root) - * @param string $sort Sort (optional) - * @param string $direction Sort direction (optional) - * @param int $limit This is the maximum number of objects that may be returned (optional, default to 25) - * @param string $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * @param string $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function listCollectionsAsyncWithHttpInfo($parent = 'root', $sort = null, $direction = null, $limit = '25', $next = null, $previous = null) - { - $returnType = '\Flat\APIClient\Model\Collection[]'; - $request = $this->listCollectionsRequest($parent, $sort, $direction, $limit, $next, $previous); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'listCollections' - * - * @param string $parent List the collection contained in this `parent` collection. This option doesn't provide a complete multi-level collection support. When sharing a collection with someone, this one will have as `parent` `sharedWithMe`. (optional, default to root) - * @param string $sort Sort (optional) - * @param string $direction Sort direction (optional) - * @param int $limit This is the maximum number of objects that may be returned (optional, default to 25) - * @param string $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * @param string $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function listCollectionsRequest($parent = 'root', $sort = null, $direction = null, $limit = '25', $next = null, $previous = null) - { - if ($limit !== null && $limit > 100) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling CollectionApi.listCollections, must be smaller than or equal to 100.'); - } - if ($limit !== null && $limit < 1) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling CollectionApi.listCollections, must be bigger than or equal to 1.'); - } - - - $resourcePath = '/collections'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($parent !== null) { - $queryParams['parent'] = ObjectSerializer::toQueryValue($parent); - } - // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } - // query params - if ($direction !== null) { - $queryParams['direction'] = ObjectSerializer::toQueryValue($direction); - } - // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } - // query params - if ($next !== null) { - $queryParams['next'] = ObjectSerializer::toQueryValue($next); - } - // query params - if ($previous !== null) { - $queryParams['previous'] = ObjectSerializer::toQueryValue($previous); - } - - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation untrashCollection - * - * Untrash a collection - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function untrashCollection($collection) - { - $this->untrashCollectionWithHttpInfo($collection); - } - - /** - * Operation untrashCollectionWithHttpInfo - * - * Untrash a collection - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function untrashCollectionWithHttpInfo($collection) - { - $returnType = ''; - $request = $this->untrashCollectionRequest($collection); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation untrashCollectionAsync - * - * Untrash a collection - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function untrashCollectionAsync($collection) - { - return $this->untrashCollectionAsyncWithHttpInfo($collection) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation untrashCollectionAsyncWithHttpInfo - * - * Untrash a collection - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function untrashCollectionAsyncWithHttpInfo($collection) - { - $returnType = ''; - $request = $this->untrashCollectionRequest($collection); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'untrashCollection' - * - * @param string $collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function untrashCollectionRequest($collection) - { - // verify the required parameter 'collection' is set - if ($collection === null || (is_array($collection) && count($collection) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $collection when calling untrashCollection' - ); - } - - $resourcePath = '/collections/{collection}/untrash'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($collection !== null) { - $resourcePath = str_replace( - '{' . 'collection' . '}', - ObjectSerializer::toPathValue($collection), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/lib/Api/GroupApi.php b/lib/Api/GroupApi.php deleted file mode 100644 index 2d153f3..0000000 --- a/lib/Api/GroupApi.php +++ /dev/null @@ -1,939 +0,0 @@ -client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation getGroupDetails - * - * Get group information - * - * @param string $group Unique identifier of a Flat group (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\GroupDetails - */ - public function getGroupDetails($group) - { - list($response) = $this->getGroupDetailsWithHttpInfo($group); - return $response; - } - - /** - * Operation getGroupDetailsWithHttpInfo - * - * Get group information - * - * @param string $group Unique identifier of a Flat group (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\GroupDetails, HTTP status code, HTTP response headers (array of strings) - */ - public function getGroupDetailsWithHttpInfo($group) - { - $returnType = '\Flat\APIClient\Model\GroupDetails'; - $request = $this->getGroupDetailsRequest($group); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\GroupDetails', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getGroupDetailsAsync - * - * Get group information - * - * @param string $group Unique identifier of a Flat group (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getGroupDetailsAsync($group) - { - return $this->getGroupDetailsAsyncWithHttpInfo($group) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getGroupDetailsAsyncWithHttpInfo - * - * Get group information - * - * @param string $group Unique identifier of a Flat group (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getGroupDetailsAsyncWithHttpInfo($group) - { - $returnType = '\Flat\APIClient\Model\GroupDetails'; - $request = $this->getGroupDetailsRequest($group); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getGroupDetails' - * - * @param string $group Unique identifier of a Flat group (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getGroupDetailsRequest($group) - { - // verify the required parameter 'group' is set - if ($group === null || (is_array($group) && count($group) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $group when calling getGroupDetails' - ); - } - - $resourcePath = '/groups/{group}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($group !== null) { - $resourcePath = str_replace( - '{' . 'group' . '}', - ObjectSerializer::toPathValue($group), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getGroupScores - * - * List group's scores - * - * @param string $group Unique identifier of a Flat group (required) - * @param string $parent Filter the score forked from the score id `parent` (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ScoreDetails[] - */ - public function getGroupScores($group, $parent = null) - { - list($response) = $this->getGroupScoresWithHttpInfo($group, $parent); - return $response; - } - - /** - * Operation getGroupScoresWithHttpInfo - * - * List group's scores - * - * @param string $group Unique identifier of a Flat group (required) - * @param string $parent Filter the score forked from the score id `parent` (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ScoreDetails[], HTTP status code, HTTP response headers (array of strings) - */ - public function getGroupScoresWithHttpInfo($group, $parent = null) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails[]'; - $request = $this->getGroupScoresRequest($group, $parent); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ScoreDetails[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getGroupScoresAsync - * - * List group's scores - * - * @param string $group Unique identifier of a Flat group (required) - * @param string $parent Filter the score forked from the score id `parent` (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getGroupScoresAsync($group, $parent = null) - { - return $this->getGroupScoresAsyncWithHttpInfo($group, $parent) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getGroupScoresAsyncWithHttpInfo - * - * List group's scores - * - * @param string $group Unique identifier of a Flat group (required) - * @param string $parent Filter the score forked from the score id `parent` (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getGroupScoresAsyncWithHttpInfo($group, $parent = null) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails[]'; - $request = $this->getGroupScoresRequest($group, $parent); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getGroupScores' - * - * @param string $group Unique identifier of a Flat group (required) - * @param string $parent Filter the score forked from the score id `parent` (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getGroupScoresRequest($group, $parent = null) - { - // verify the required parameter 'group' is set - if ($group === null || (is_array($group) && count($group) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $group when calling getGroupScores' - ); - } - - $resourcePath = '/groups/{group}/scores'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($parent !== null) { - $queryParams['parent'] = ObjectSerializer::toQueryValue($parent); - } - - // path params - if ($group !== null) { - $resourcePath = str_replace( - '{' . 'group' . '}', - ObjectSerializer::toPathValue($group), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation listGroupUsers - * - * List group's users - * - * @param string $group Unique identifier of a Flat group (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\UserPublic[] - */ - public function listGroupUsers($group) - { - list($response) = $this->listGroupUsersWithHttpInfo($group); - return $response; - } - - /** - * Operation listGroupUsersWithHttpInfo - * - * List group's users - * - * @param string $group Unique identifier of a Flat group (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\UserPublic[], HTTP status code, HTTP response headers (array of strings) - */ - public function listGroupUsersWithHttpInfo($group) - { - $returnType = '\Flat\APIClient\Model\UserPublic[]'; - $request = $this->listGroupUsersRequest($group); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\UserPublic[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation listGroupUsersAsync - * - * List group's users - * - * @param string $group Unique identifier of a Flat group (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function listGroupUsersAsync($group) - { - return $this->listGroupUsersAsyncWithHttpInfo($group) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation listGroupUsersAsyncWithHttpInfo - * - * List group's users - * - * @param string $group Unique identifier of a Flat group (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function listGroupUsersAsyncWithHttpInfo($group) - { - $returnType = '\Flat\APIClient\Model\UserPublic[]'; - $request = $this->listGroupUsersRequest($group); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'listGroupUsers' - * - * @param string $group Unique identifier of a Flat group (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function listGroupUsersRequest($group) - { - // verify the required parameter 'group' is set - if ($group === null || (is_array($group) && count($group) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $group when calling listGroupUsers' - ); - } - - $resourcePath = '/groups/{group}/users'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($group !== null) { - $resourcePath = str_replace( - '{' . 'group' . '}', - ObjectSerializer::toPathValue($group), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/lib/Api/OrganizationApi.php b/lib/Api/OrganizationApi.php deleted file mode 100644 index 38b67eb..0000000 --- a/lib/Api/OrganizationApi.php +++ /dev/null @@ -1,2794 +0,0 @@ -client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation createLtiCredentials - * - * Create a new couple of LTI 1.x credentials - * - * @param \Flat\APIClient\Model\LtiCredentialsCreation $body body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\LtiCredentials - */ - public function createLtiCredentials($body) - { - list($response) = $this->createLtiCredentialsWithHttpInfo($body); - return $response; - } - - /** - * Operation createLtiCredentialsWithHttpInfo - * - * Create a new couple of LTI 1.x credentials - * - * @param \Flat\APIClient\Model\LtiCredentialsCreation $body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\LtiCredentials, HTTP status code, HTTP response headers (array of strings) - */ - public function createLtiCredentialsWithHttpInfo($body) - { - $returnType = '\Flat\APIClient\Model\LtiCredentials'; - $request = $this->createLtiCredentialsRequest($body); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\LtiCredentials', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation createLtiCredentialsAsync - * - * Create a new couple of LTI 1.x credentials - * - * @param \Flat\APIClient\Model\LtiCredentialsCreation $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createLtiCredentialsAsync($body) - { - return $this->createLtiCredentialsAsyncWithHttpInfo($body) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createLtiCredentialsAsyncWithHttpInfo - * - * Create a new couple of LTI 1.x credentials - * - * @param \Flat\APIClient\Model\LtiCredentialsCreation $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createLtiCredentialsAsyncWithHttpInfo($body) - { - $returnType = '\Flat\APIClient\Model\LtiCredentials'; - $request = $this->createLtiCredentialsRequest($body); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'createLtiCredentials' - * - * @param \Flat\APIClient\Model\LtiCredentialsCreation $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function createLtiCredentialsRequest($body) - { - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling createLtiCredentials' - ); - } - - $resourcePath = '/organizations/lti/credentials'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation createOrganizationInvitation - * - * Create a new invitation to join the organization - * - * @param \Flat\APIClient\Model\OrganizationInvitationCreation $body body (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\OrganizationInvitation - */ - public function createOrganizationInvitation($body = null) - { - list($response) = $this->createOrganizationInvitationWithHttpInfo($body); - return $response; - } - - /** - * Operation createOrganizationInvitationWithHttpInfo - * - * Create a new invitation to join the organization - * - * @param \Flat\APIClient\Model\OrganizationInvitationCreation $body (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\OrganizationInvitation, HTTP status code, HTTP response headers (array of strings) - */ - public function createOrganizationInvitationWithHttpInfo($body = null) - { - $returnType = '\Flat\APIClient\Model\OrganizationInvitation'; - $request = $this->createOrganizationInvitationRequest($body); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\OrganizationInvitation', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation createOrganizationInvitationAsync - * - * Create a new invitation to join the organization - * - * @param \Flat\APIClient\Model\OrganizationInvitationCreation $body (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createOrganizationInvitationAsync($body = null) - { - return $this->createOrganizationInvitationAsyncWithHttpInfo($body) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createOrganizationInvitationAsyncWithHttpInfo - * - * Create a new invitation to join the organization - * - * @param \Flat\APIClient\Model\OrganizationInvitationCreation $body (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createOrganizationInvitationAsyncWithHttpInfo($body = null) - { - $returnType = '\Flat\APIClient\Model\OrganizationInvitation'; - $request = $this->createOrganizationInvitationRequest($body); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'createOrganizationInvitation' - * - * @param \Flat\APIClient\Model\OrganizationInvitationCreation $body (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function createOrganizationInvitationRequest($body = null) - { - - $resourcePath = '/organizations/invitations'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation createOrganizationUser - * - * Create a new user account - * - * @param \Flat\APIClient\Model\UserCreation $body body (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\UserDetailsAdmin - */ - public function createOrganizationUser($body = null) - { - list($response) = $this->createOrganizationUserWithHttpInfo($body); - return $response; - } - - /** - * Operation createOrganizationUserWithHttpInfo - * - * Create a new user account - * - * @param \Flat\APIClient\Model\UserCreation $body (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\UserDetailsAdmin, HTTP status code, HTTP response headers (array of strings) - */ - public function createOrganizationUserWithHttpInfo($body = null) - { - $returnType = '\Flat\APIClient\Model\UserDetailsAdmin'; - $request = $this->createOrganizationUserRequest($body); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\UserDetailsAdmin', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation createOrganizationUserAsync - * - * Create a new user account - * - * @param \Flat\APIClient\Model\UserCreation $body (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createOrganizationUserAsync($body = null) - { - return $this->createOrganizationUserAsyncWithHttpInfo($body) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createOrganizationUserAsyncWithHttpInfo - * - * Create a new user account - * - * @param \Flat\APIClient\Model\UserCreation $body (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createOrganizationUserAsyncWithHttpInfo($body = null) - { - $returnType = '\Flat\APIClient\Model\UserDetailsAdmin'; - $request = $this->createOrganizationUserRequest($body); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'createOrganizationUser' - * - * @param \Flat\APIClient\Model\UserCreation $body (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function createOrganizationUserRequest($body = null) - { - - $resourcePath = '/organizations/users'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation listLtiCredentials - * - * List LTI 1.x credentials - * - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\LtiCredentials[] - */ - public function listLtiCredentials() - { - list($response) = $this->listLtiCredentialsWithHttpInfo(); - return $response; - } - - /** - * Operation listLtiCredentialsWithHttpInfo - * - * List LTI 1.x credentials - * - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\LtiCredentials[], HTTP status code, HTTP response headers (array of strings) - */ - public function listLtiCredentialsWithHttpInfo() - { - $returnType = '\Flat\APIClient\Model\LtiCredentials[]'; - $request = $this->listLtiCredentialsRequest(); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\LtiCredentials[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation listLtiCredentialsAsync - * - * List LTI 1.x credentials - * - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function listLtiCredentialsAsync() - { - return $this->listLtiCredentialsAsyncWithHttpInfo() - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation listLtiCredentialsAsyncWithHttpInfo - * - * List LTI 1.x credentials - * - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function listLtiCredentialsAsyncWithHttpInfo() - { - $returnType = '\Flat\APIClient\Model\LtiCredentials[]'; - $request = $this->listLtiCredentialsRequest(); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'listLtiCredentials' - * - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function listLtiCredentialsRequest() - { - - $resourcePath = '/organizations/lti/credentials'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation listOrganizationInvitations - * - * List the organization invitations - * - * @param string $role Filter users by role (optional) - * @param int $limit This is the maximum number of objects that may be returned (optional, default to 50) - * @param string $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * @param string $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\OrganizationInvitation[] - */ - public function listOrganizationInvitations($role = null, $limit = '50', $next = null, $previous = null) - { - list($response) = $this->listOrganizationInvitationsWithHttpInfo($role, $limit, $next, $previous); - return $response; - } - - /** - * Operation listOrganizationInvitationsWithHttpInfo - * - * List the organization invitations - * - * @param string $role Filter users by role (optional) - * @param int $limit This is the maximum number of objects that may be returned (optional, default to 50) - * @param string $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * @param string $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\OrganizationInvitation[], HTTP status code, HTTP response headers (array of strings) - */ - public function listOrganizationInvitationsWithHttpInfo($role = null, $limit = '50', $next = null, $previous = null) - { - $returnType = '\Flat\APIClient\Model\OrganizationInvitation[]'; - $request = $this->listOrganizationInvitationsRequest($role, $limit, $next, $previous); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\OrganizationInvitation[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation listOrganizationInvitationsAsync - * - * List the organization invitations - * - * @param string $role Filter users by role (optional) - * @param int $limit This is the maximum number of objects that may be returned (optional, default to 50) - * @param string $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * @param string $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function listOrganizationInvitationsAsync($role = null, $limit = '50', $next = null, $previous = null) - { - return $this->listOrganizationInvitationsAsyncWithHttpInfo($role, $limit, $next, $previous) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation listOrganizationInvitationsAsyncWithHttpInfo - * - * List the organization invitations - * - * @param string $role Filter users by role (optional) - * @param int $limit This is the maximum number of objects that may be returned (optional, default to 50) - * @param string $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * @param string $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function listOrganizationInvitationsAsyncWithHttpInfo($role = null, $limit = '50', $next = null, $previous = null) - { - $returnType = '\Flat\APIClient\Model\OrganizationInvitation[]'; - $request = $this->listOrganizationInvitationsRequest($role, $limit, $next, $previous); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'listOrganizationInvitations' - * - * @param string $role Filter users by role (optional) - * @param int $limit This is the maximum number of objects that may be returned (optional, default to 50) - * @param string $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * @param string $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function listOrganizationInvitationsRequest($role = null, $limit = '50', $next = null, $previous = null) - { - if ($limit !== null && $limit > 1000) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling OrganizationApi.listOrganizationInvitations, must be smaller than or equal to 1000.'); - } - if ($limit !== null && $limit < 1) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling OrganizationApi.listOrganizationInvitations, must be bigger than or equal to 1.'); - } - - - $resourcePath = '/organizations/invitations'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($role !== null) { - $queryParams['role'] = ObjectSerializer::toQueryValue($role); - } - // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } - // query params - if ($next !== null) { - $queryParams['next'] = ObjectSerializer::toQueryValue($next); - } - // query params - if ($previous !== null) { - $queryParams['previous'] = ObjectSerializer::toQueryValue($previous); - } - - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation listOrganizationUsers - * - * List the organization users - * - * @param string $role Filter users by role (optional) - * @param int $limit This is the maximum number of objects that may be returned (optional, default to 50) - * @param string $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * @param string $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\UserDetailsAdmin[] - */ - public function listOrganizationUsers($role = null, $limit = '50', $next = null, $previous = null) - { - list($response) = $this->listOrganizationUsersWithHttpInfo($role, $limit, $next, $previous); - return $response; - } - - /** - * Operation listOrganizationUsersWithHttpInfo - * - * List the organization users - * - * @param string $role Filter users by role (optional) - * @param int $limit This is the maximum number of objects that may be returned (optional, default to 50) - * @param string $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * @param string $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\UserDetailsAdmin[], HTTP status code, HTTP response headers (array of strings) - */ - public function listOrganizationUsersWithHttpInfo($role = null, $limit = '50', $next = null, $previous = null) - { - $returnType = '\Flat\APIClient\Model\UserDetailsAdmin[]'; - $request = $this->listOrganizationUsersRequest($role, $limit, $next, $previous); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\UserDetailsAdmin[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation listOrganizationUsersAsync - * - * List the organization users - * - * @param string $role Filter users by role (optional) - * @param int $limit This is the maximum number of objects that may be returned (optional, default to 50) - * @param string $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * @param string $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function listOrganizationUsersAsync($role = null, $limit = '50', $next = null, $previous = null) - { - return $this->listOrganizationUsersAsyncWithHttpInfo($role, $limit, $next, $previous) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation listOrganizationUsersAsyncWithHttpInfo - * - * List the organization users - * - * @param string $role Filter users by role (optional) - * @param int $limit This is the maximum number of objects that may be returned (optional, default to 50) - * @param string $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * @param string $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function listOrganizationUsersAsyncWithHttpInfo($role = null, $limit = '50', $next = null, $previous = null) - { - $returnType = '\Flat\APIClient\Model\UserDetailsAdmin[]'; - $request = $this->listOrganizationUsersRequest($role, $limit, $next, $previous); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'listOrganizationUsers' - * - * @param string $role Filter users by role (optional) - * @param int $limit This is the maximum number of objects that may be returned (optional, default to 50) - * @param string $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * @param string $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function listOrganizationUsersRequest($role = null, $limit = '50', $next = null, $previous = null) - { - if ($limit !== null && $limit > 1000) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling OrganizationApi.listOrganizationUsers, must be smaller than or equal to 1000.'); - } - if ($limit !== null && $limit < 1) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling OrganizationApi.listOrganizationUsers, must be bigger than or equal to 1.'); - } - - - $resourcePath = '/organizations/users'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($role !== null) { - $queryParams['role'] = ObjectSerializer::toQueryValue($role); - } - // query params - if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } - // query params - if ($next !== null) { - $queryParams['next'] = ObjectSerializer::toQueryValue($next); - } - // query params - if ($previous !== null) { - $queryParams['previous'] = ObjectSerializer::toQueryValue($previous); - } - - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation removeOrganizationInvitation - * - * Remove an organization invitation - * - * @param string $invitation Unique identifier of the invitation (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function removeOrganizationInvitation($invitation) - { - $this->removeOrganizationInvitationWithHttpInfo($invitation); - } - - /** - * Operation removeOrganizationInvitationWithHttpInfo - * - * Remove an organization invitation - * - * @param string $invitation Unique identifier of the invitation (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function removeOrganizationInvitationWithHttpInfo($invitation) - { - $returnType = ''; - $request = $this->removeOrganizationInvitationRequest($invitation); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation removeOrganizationInvitationAsync - * - * Remove an organization invitation - * - * @param string $invitation Unique identifier of the invitation (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function removeOrganizationInvitationAsync($invitation) - { - return $this->removeOrganizationInvitationAsyncWithHttpInfo($invitation) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation removeOrganizationInvitationAsyncWithHttpInfo - * - * Remove an organization invitation - * - * @param string $invitation Unique identifier of the invitation (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function removeOrganizationInvitationAsyncWithHttpInfo($invitation) - { - $returnType = ''; - $request = $this->removeOrganizationInvitationRequest($invitation); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'removeOrganizationInvitation' - * - * @param string $invitation Unique identifier of the invitation (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function removeOrganizationInvitationRequest($invitation) - { - // verify the required parameter 'invitation' is set - if ($invitation === null || (is_array($invitation) && count($invitation) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $invitation when calling removeOrganizationInvitation' - ); - } - - $resourcePath = '/organizations/invitations/{invitation}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($invitation !== null) { - $resourcePath = str_replace( - '{' . 'invitation' . '}', - ObjectSerializer::toPathValue($invitation), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation removeOrganizationUser - * - * Remove an account from Flat - * - * @param string $user Unique identifier of the Flat account (required) - * @param bool $convertToIndividual If `true`, the account will be only removed from the organization and converted into an individual account on our public website, https://flat.io. This operation will remove the education-related data from the account. Before realizing this operation, you need to be sure that the user is at least 13 years old and that this one has read and agreed to the Individual Terms of Services of Flat available on https://flat.io/legal. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function removeOrganizationUser($user, $convertToIndividual = null) - { - $this->removeOrganizationUserWithHttpInfo($user, $convertToIndividual); - } - - /** - * Operation removeOrganizationUserWithHttpInfo - * - * Remove an account from Flat - * - * @param string $user Unique identifier of the Flat account (required) - * @param bool $convertToIndividual If `true`, the account will be only removed from the organization and converted into an individual account on our public website, https://flat.io. This operation will remove the education-related data from the account. Before realizing this operation, you need to be sure that the user is at least 13 years old and that this one has read and agreed to the Individual Terms of Services of Flat available on https://flat.io/legal. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function removeOrganizationUserWithHttpInfo($user, $convertToIndividual = null) - { - $returnType = ''; - $request = $this->removeOrganizationUserRequest($user, $convertToIndividual); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation removeOrganizationUserAsync - * - * Remove an account from Flat - * - * @param string $user Unique identifier of the Flat account (required) - * @param bool $convertToIndividual If `true`, the account will be only removed from the organization and converted into an individual account on our public website, https://flat.io. This operation will remove the education-related data from the account. Before realizing this operation, you need to be sure that the user is at least 13 years old and that this one has read and agreed to the Individual Terms of Services of Flat available on https://flat.io/legal. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function removeOrganizationUserAsync($user, $convertToIndividual = null) - { - return $this->removeOrganizationUserAsyncWithHttpInfo($user, $convertToIndividual) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation removeOrganizationUserAsyncWithHttpInfo - * - * Remove an account from Flat - * - * @param string $user Unique identifier of the Flat account (required) - * @param bool $convertToIndividual If `true`, the account will be only removed from the organization and converted into an individual account on our public website, https://flat.io. This operation will remove the education-related data from the account. Before realizing this operation, you need to be sure that the user is at least 13 years old and that this one has read and agreed to the Individual Terms of Services of Flat available on https://flat.io/legal. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function removeOrganizationUserAsyncWithHttpInfo($user, $convertToIndividual = null) - { - $returnType = ''; - $request = $this->removeOrganizationUserRequest($user, $convertToIndividual); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'removeOrganizationUser' - * - * @param string $user Unique identifier of the Flat account (required) - * @param bool $convertToIndividual If `true`, the account will be only removed from the organization and converted into an individual account on our public website, https://flat.io. This operation will remove the education-related data from the account. Before realizing this operation, you need to be sure that the user is at least 13 years old and that this one has read and agreed to the Individual Terms of Services of Flat available on https://flat.io/legal. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function removeOrganizationUserRequest($user, $convertToIndividual = null) - { - // verify the required parameter 'user' is set - if ($user === null || (is_array($user) && count($user) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $user when calling removeOrganizationUser' - ); - } - - $resourcePath = '/organizations/users/{user}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($convertToIndividual !== null) { - $queryParams['convertToIndividual'] = ObjectSerializer::toQueryValue($convertToIndividual); - } - - // path params - if ($user !== null) { - $resourcePath = str_replace( - '{' . 'user' . '}', - ObjectSerializer::toPathValue($user), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation revokeLtiCredentials - * - * Revoke LTI 1.x credentials - * - * @param string $credentials Credentials unique identifier (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function revokeLtiCredentials($credentials) - { - $this->revokeLtiCredentialsWithHttpInfo($credentials); - } - - /** - * Operation revokeLtiCredentialsWithHttpInfo - * - * Revoke LTI 1.x credentials - * - * @param string $credentials Credentials unique identifier (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function revokeLtiCredentialsWithHttpInfo($credentials) - { - $returnType = ''; - $request = $this->revokeLtiCredentialsRequest($credentials); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation revokeLtiCredentialsAsync - * - * Revoke LTI 1.x credentials - * - * @param string $credentials Credentials unique identifier (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function revokeLtiCredentialsAsync($credentials) - { - return $this->revokeLtiCredentialsAsyncWithHttpInfo($credentials) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation revokeLtiCredentialsAsyncWithHttpInfo - * - * Revoke LTI 1.x credentials - * - * @param string $credentials Credentials unique identifier (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function revokeLtiCredentialsAsyncWithHttpInfo($credentials) - { - $returnType = ''; - $request = $this->revokeLtiCredentialsRequest($credentials); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'revokeLtiCredentials' - * - * @param string $credentials Credentials unique identifier (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function revokeLtiCredentialsRequest($credentials) - { - // verify the required parameter 'credentials' is set - if ($credentials === null || (is_array($credentials) && count($credentials) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $credentials when calling revokeLtiCredentials' - ); - } - - $resourcePath = '/organizations/lti/credentials/{credentials}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($credentials !== null) { - $resourcePath = str_replace( - '{' . 'credentials' . '}', - ObjectSerializer::toPathValue($credentials), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation updateOrganizationUser - * - * Update account information - * - * @param string $user Unique identifier of the Flat account (required) - * @param \Flat\APIClient\Model\UserAdminUpdate $body body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\UserDetailsAdmin - */ - public function updateOrganizationUser($user, $body) - { - list($response) = $this->updateOrganizationUserWithHttpInfo($user, $body); - return $response; - } - - /** - * Operation updateOrganizationUserWithHttpInfo - * - * Update account information - * - * @param string $user Unique identifier of the Flat account (required) - * @param \Flat\APIClient\Model\UserAdminUpdate $body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\UserDetailsAdmin, HTTP status code, HTTP response headers (array of strings) - */ - public function updateOrganizationUserWithHttpInfo($user, $body) - { - $returnType = '\Flat\APIClient\Model\UserDetailsAdmin'; - $request = $this->updateOrganizationUserRequest($user, $body); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\UserDetailsAdmin', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation updateOrganizationUserAsync - * - * Update account information - * - * @param string $user Unique identifier of the Flat account (required) - * @param \Flat\APIClient\Model\UserAdminUpdate $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateOrganizationUserAsync($user, $body) - { - return $this->updateOrganizationUserAsyncWithHttpInfo($user, $body) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateOrganizationUserAsyncWithHttpInfo - * - * Update account information - * - * @param string $user Unique identifier of the Flat account (required) - * @param \Flat\APIClient\Model\UserAdminUpdate $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateOrganizationUserAsyncWithHttpInfo($user, $body) - { - $returnType = '\Flat\APIClient\Model\UserDetailsAdmin'; - $request = $this->updateOrganizationUserRequest($user, $body); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'updateOrganizationUser' - * - * @param string $user Unique identifier of the Flat account (required) - * @param \Flat\APIClient\Model\UserAdminUpdate $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function updateOrganizationUserRequest($user, $body) - { - // verify the required parameter 'user' is set - if ($user === null || (is_array($user) && count($user) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $user when calling updateOrganizationUser' - ); - } - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling updateOrganizationUser' - ); - } - - $resourcePath = '/organizations/users/{user}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($user !== null) { - $resourcePath = str_replace( - '{' . 'user' . '}', - ObjectSerializer::toPathValue($user), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/lib/Api/ScoreApi.php b/lib/Api/ScoreApi.php deleted file mode 100644 index 4560599..0000000 --- a/lib/Api/ScoreApi.php +++ /dev/null @@ -1,8815 +0,0 @@ -client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation addScoreCollaborator - * - * Add a new collaborator - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ResourceCollaboratorCreation $body body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ResourceCollaborator - */ - public function addScoreCollaborator($score, $body) - { - list($response) = $this->addScoreCollaboratorWithHttpInfo($score, $body); - return $response; - } - - /** - * Operation addScoreCollaboratorWithHttpInfo - * - * Add a new collaborator - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ResourceCollaboratorCreation $body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ResourceCollaborator, HTTP status code, HTTP response headers (array of strings) - */ - public function addScoreCollaboratorWithHttpInfo($score, $body) - { - $returnType = '\Flat\APIClient\Model\ResourceCollaborator'; - $request = $this->addScoreCollaboratorRequest($score, $body); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ResourceCollaborator', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 402: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation addScoreCollaboratorAsync - * - * Add a new collaborator - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ResourceCollaboratorCreation $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function addScoreCollaboratorAsync($score, $body) - { - return $this->addScoreCollaboratorAsyncWithHttpInfo($score, $body) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation addScoreCollaboratorAsyncWithHttpInfo - * - * Add a new collaborator - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ResourceCollaboratorCreation $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function addScoreCollaboratorAsyncWithHttpInfo($score, $body) - { - $returnType = '\Flat\APIClient\Model\ResourceCollaborator'; - $request = $this->addScoreCollaboratorRequest($score, $body); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'addScoreCollaborator' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ResourceCollaboratorCreation $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function addScoreCollaboratorRequest($score, $body) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling addScoreCollaborator' - ); - } - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling addScoreCollaborator' - ); - } - - $resourcePath = '/scores/{score}/collaborators'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation addScoreTrack - * - * Add a new video or audio track to the score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreTrackCreation $body body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ScoreTrack - */ - public function addScoreTrack($score, $body) - { - list($response) = $this->addScoreTrackWithHttpInfo($score, $body); - return $response; - } - - /** - * Operation addScoreTrackWithHttpInfo - * - * Add a new video or audio track to the score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreTrackCreation $body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ScoreTrack, HTTP status code, HTTP response headers (array of strings) - */ - public function addScoreTrackWithHttpInfo($score, $body) - { - $returnType = '\Flat\APIClient\Model\ScoreTrack'; - $request = $this->addScoreTrackRequest($score, $body); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ScoreTrack', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation addScoreTrackAsync - * - * Add a new video or audio track to the score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreTrackCreation $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function addScoreTrackAsync($score, $body) - { - return $this->addScoreTrackAsyncWithHttpInfo($score, $body) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation addScoreTrackAsyncWithHttpInfo - * - * Add a new video or audio track to the score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreTrackCreation $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function addScoreTrackAsyncWithHttpInfo($score, $body) - { - $returnType = '\Flat\APIClient\Model\ScoreTrack'; - $request = $this->addScoreTrackRequest($score, $body); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'addScoreTrack' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreTrackCreation $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function addScoreTrackRequest($score, $body) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling addScoreTrack' - ); - } - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling addScoreTrack' - ); - } - - $resourcePath = '/scores/{score}/tracks'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation createScore - * - * Create a new score - * - * @param \Flat\APIClient\Model\ScoreCreation $body body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ScoreDetails - */ - public function createScore($body) - { - list($response) = $this->createScoreWithHttpInfo($body); - return $response; - } - - /** - * Operation createScoreWithHttpInfo - * - * Create a new score - * - * @param \Flat\APIClient\Model\ScoreCreation $body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ScoreDetails, HTTP status code, HTTP response headers (array of strings) - */ - public function createScoreWithHttpInfo($body) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails'; - $request = $this->createScoreRequest($body); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ScoreDetails', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 402: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation createScoreAsync - * - * Create a new score - * - * @param \Flat\APIClient\Model\ScoreCreation $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createScoreAsync($body) - { - return $this->createScoreAsyncWithHttpInfo($body) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createScoreAsyncWithHttpInfo - * - * Create a new score - * - * @param \Flat\APIClient\Model\ScoreCreation $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createScoreAsyncWithHttpInfo($body) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails'; - $request = $this->createScoreRequest($body); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'createScore' - * - * @param \Flat\APIClient\Model\ScoreCreation $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function createScoreRequest($body) - { - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling createScore' - ); - } - - $resourcePath = '/scores'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation createScoreRevision - * - * Create a new revision - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreRevisionCreation $body body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ScoreRevision - */ - public function createScoreRevision($score, $body) - { - list($response) = $this->createScoreRevisionWithHttpInfo($score, $body); - return $response; - } - - /** - * Operation createScoreRevisionWithHttpInfo - * - * Create a new revision - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreRevisionCreation $body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ScoreRevision, HTTP status code, HTTP response headers (array of strings) - */ - public function createScoreRevisionWithHttpInfo($score, $body) - { - $returnType = '\Flat\APIClient\Model\ScoreRevision'; - $request = $this->createScoreRevisionRequest($score, $body); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ScoreRevision', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 402: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation createScoreRevisionAsync - * - * Create a new revision - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreRevisionCreation $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createScoreRevisionAsync($score, $body) - { - return $this->createScoreRevisionAsyncWithHttpInfo($score, $body) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createScoreRevisionAsyncWithHttpInfo - * - * Create a new revision - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreRevisionCreation $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createScoreRevisionAsyncWithHttpInfo($score, $body) - { - $returnType = '\Flat\APIClient\Model\ScoreRevision'; - $request = $this->createScoreRevisionRequest($score, $body); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'createScoreRevision' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreRevisionCreation $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function createScoreRevisionRequest($score, $body) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling createScoreRevision' - ); - } - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling createScoreRevision' - ); - } - - $resourcePath = '/scores/{score}/revisions'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation deleteScore - * - * Delete a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function deleteScore($score) - { - $this->deleteScoreWithHttpInfo($score); - } - - /** - * Operation deleteScoreWithHttpInfo - * - * Delete a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function deleteScoreWithHttpInfo($score) - { - $returnType = ''; - $request = $this->deleteScoreRequest($score); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deleteScoreAsync - * - * Delete a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteScoreAsync($score) - { - return $this->deleteScoreAsyncWithHttpInfo($score) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation deleteScoreAsyncWithHttpInfo - * - * Delete a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteScoreAsyncWithHttpInfo($score) - { - $returnType = ''; - $request = $this->deleteScoreRequest($score); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'deleteScore' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function deleteScoreRequest($score) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling deleteScore' - ); - } - - $resourcePath = '/scores/{score}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation deleteScoreComment - * - * Delete a comment - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $comment Unique identifier of a sheet music comment (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function deleteScoreComment($score, $comment, $sharingKey = null) - { - $this->deleteScoreCommentWithHttpInfo($score, $comment, $sharingKey); - } - - /** - * Operation deleteScoreCommentWithHttpInfo - * - * Delete a comment - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $comment Unique identifier of a sheet music comment (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function deleteScoreCommentWithHttpInfo($score, $comment, $sharingKey = null) - { - $returnType = ''; - $request = $this->deleteScoreCommentRequest($score, $comment, $sharingKey); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deleteScoreCommentAsync - * - * Delete a comment - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $comment Unique identifier of a sheet music comment (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteScoreCommentAsync($score, $comment, $sharingKey = null) - { - return $this->deleteScoreCommentAsyncWithHttpInfo($score, $comment, $sharingKey) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation deleteScoreCommentAsyncWithHttpInfo - * - * Delete a comment - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $comment Unique identifier of a sheet music comment (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteScoreCommentAsyncWithHttpInfo($score, $comment, $sharingKey = null) - { - $returnType = ''; - $request = $this->deleteScoreCommentRequest($score, $comment, $sharingKey); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'deleteScoreComment' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $comment Unique identifier of a sheet music comment (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function deleteScoreCommentRequest($score, $comment, $sharingKey = null) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling deleteScoreComment' - ); - } - // verify the required parameter 'comment' is set - if ($comment === null || (is_array($comment) && count($comment) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $comment when calling deleteScoreComment' - ); - } - - $resourcePath = '/scores/{score}/comments/{comment}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($sharingKey !== null) { - $queryParams['sharingKey'] = ObjectSerializer::toQueryValue($sharingKey); - } - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - // path params - if ($comment !== null) { - $resourcePath = str_replace( - '{' . 'comment' . '}', - ObjectSerializer::toPathValue($comment), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation deleteScoreTrack - * - * Remove an audio or video track linked to the score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $track Unique identifier of a score audio track (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function deleteScoreTrack($score, $track) - { - $this->deleteScoreTrackWithHttpInfo($score, $track); - } - - /** - * Operation deleteScoreTrackWithHttpInfo - * - * Remove an audio or video track linked to the score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $track Unique identifier of a score audio track (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function deleteScoreTrackWithHttpInfo($score, $track) - { - $returnType = ''; - $request = $this->deleteScoreTrackRequest($score, $track); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deleteScoreTrackAsync - * - * Remove an audio or video track linked to the score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $track Unique identifier of a score audio track (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteScoreTrackAsync($score, $track) - { - return $this->deleteScoreTrackAsyncWithHttpInfo($score, $track) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation deleteScoreTrackAsyncWithHttpInfo - * - * Remove an audio or video track linked to the score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $track Unique identifier of a score audio track (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteScoreTrackAsyncWithHttpInfo($score, $track) - { - $returnType = ''; - $request = $this->deleteScoreTrackRequest($score, $track); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'deleteScoreTrack' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $track Unique identifier of a score audio track (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function deleteScoreTrackRequest($score, $track) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling deleteScoreTrack' - ); - } - // verify the required parameter 'track' is set - if ($track === null || (is_array($track) && count($track) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $track when calling deleteScoreTrack' - ); - } - - $resourcePath = '/scores/{score}/tracks/{track}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - // path params - if ($track !== null) { - $resourcePath = str_replace( - '{' . 'track' . '}', - ObjectSerializer::toPathValue($track), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation editScore - * - * Edit a score's metadata - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreModification $body body (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ScoreDetails - */ - public function editScore($score, $body = null) - { - list($response) = $this->editScoreWithHttpInfo($score, $body); - return $response; - } - - /** - * Operation editScoreWithHttpInfo - * - * Edit a score's metadata - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreModification $body (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ScoreDetails, HTTP status code, HTTP response headers (array of strings) - */ - public function editScoreWithHttpInfo($score, $body = null) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails'; - $request = $this->editScoreRequest($score, $body); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ScoreDetails', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 402: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation editScoreAsync - * - * Edit a score's metadata - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreModification $body (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function editScoreAsync($score, $body = null) - { - return $this->editScoreAsyncWithHttpInfo($score, $body) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation editScoreAsyncWithHttpInfo - * - * Edit a score's metadata - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreModification $body (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function editScoreAsyncWithHttpInfo($score, $body = null) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails'; - $request = $this->editScoreRequest($score, $body); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'editScore' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreModification $body (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function editScoreRequest($score, $body = null) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling editScore' - ); - } - - $resourcePath = '/scores/{score}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation forkScore - * - * Fork a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreFork $body body (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ScoreDetails - */ - public function forkScore($score, $body, $sharingKey = null) - { - list($response) = $this->forkScoreWithHttpInfo($score, $body, $sharingKey); - return $response; - } - - /** - * Operation forkScoreWithHttpInfo - * - * Fork a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreFork $body (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ScoreDetails, HTTP status code, HTTP response headers (array of strings) - */ - public function forkScoreWithHttpInfo($score, $body, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails'; - $request = $this->forkScoreRequest($score, $body, $sharingKey); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ScoreDetails', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 402: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation forkScoreAsync - * - * Fork a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreFork $body (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function forkScoreAsync($score, $body, $sharingKey = null) - { - return $this->forkScoreAsyncWithHttpInfo($score, $body, $sharingKey) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation forkScoreAsyncWithHttpInfo - * - * Fork a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreFork $body (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function forkScoreAsyncWithHttpInfo($score, $body, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails'; - $request = $this->forkScoreRequest($score, $body, $sharingKey); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'forkScore' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreFork $body (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function forkScoreRequest($score, $body, $sharingKey = null) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling forkScore' - ); - } - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling forkScore' - ); - } - - $resourcePath = '/scores/{score}/fork'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($sharingKey !== null) { - $queryParams['sharingKey'] = ObjectSerializer::toQueryValue($sharingKey); - } - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation gerUserLikes - * - * List liked scores - * - * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - * @param bool $ids Return only the identifiers of the scores (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ScoreDetails[] - */ - public function gerUserLikes($user, $ids = null) - { - list($response) = $this->gerUserLikesWithHttpInfo($user, $ids); - return $response; - } - - /** - * Operation gerUserLikesWithHttpInfo - * - * List liked scores - * - * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - * @param bool $ids Return only the identifiers of the scores (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ScoreDetails[], HTTP status code, HTTP response headers (array of strings) - */ - public function gerUserLikesWithHttpInfo($user, $ids = null) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails[]'; - $request = $this->gerUserLikesRequest($user, $ids); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ScoreDetails[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation gerUserLikesAsync - * - * List liked scores - * - * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - * @param bool $ids Return only the identifiers of the scores (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function gerUserLikesAsync($user, $ids = null) - { - return $this->gerUserLikesAsyncWithHttpInfo($user, $ids) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation gerUserLikesAsyncWithHttpInfo - * - * List liked scores - * - * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - * @param bool $ids Return only the identifiers of the scores (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function gerUserLikesAsyncWithHttpInfo($user, $ids = null) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails[]'; - $request = $this->gerUserLikesRequest($user, $ids); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'gerUserLikes' - * - * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - * @param bool $ids Return only the identifiers of the scores (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function gerUserLikesRequest($user, $ids = null) - { - // verify the required parameter 'user' is set - if ($user === null || (is_array($user) && count($user) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $user when calling gerUserLikes' - ); - } - - $resourcePath = '/users/{user}/likes'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($ids !== null) { - $queryParams['ids'] = ObjectSerializer::toQueryValue($ids); - } - - // path params - if ($user !== null) { - $resourcePath = str_replace( - '{' . 'user' . '}', - ObjectSerializer::toPathValue($user), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getGroupScores - * - * List group's scores - * - * @param string $group Unique identifier of a Flat group (required) - * @param string $parent Filter the score forked from the score id `parent` (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ScoreDetails[] - */ - public function getGroupScores($group, $parent = null) - { - list($response) = $this->getGroupScoresWithHttpInfo($group, $parent); - return $response; - } - - /** - * Operation getGroupScoresWithHttpInfo - * - * List group's scores - * - * @param string $group Unique identifier of a Flat group (required) - * @param string $parent Filter the score forked from the score id `parent` (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ScoreDetails[], HTTP status code, HTTP response headers (array of strings) - */ - public function getGroupScoresWithHttpInfo($group, $parent = null) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails[]'; - $request = $this->getGroupScoresRequest($group, $parent); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ScoreDetails[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getGroupScoresAsync - * - * List group's scores - * - * @param string $group Unique identifier of a Flat group (required) - * @param string $parent Filter the score forked from the score id `parent` (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getGroupScoresAsync($group, $parent = null) - { - return $this->getGroupScoresAsyncWithHttpInfo($group, $parent) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getGroupScoresAsyncWithHttpInfo - * - * List group's scores - * - * @param string $group Unique identifier of a Flat group (required) - * @param string $parent Filter the score forked from the score id `parent` (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getGroupScoresAsyncWithHttpInfo($group, $parent = null) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails[]'; - $request = $this->getGroupScoresRequest($group, $parent); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getGroupScores' - * - * @param string $group Unique identifier of a Flat group (required) - * @param string $parent Filter the score forked from the score id `parent` (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getGroupScoresRequest($group, $parent = null) - { - // verify the required parameter 'group' is set - if ($group === null || (is_array($group) && count($group) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $group when calling getGroupScores' - ); - } - - $resourcePath = '/groups/{group}/scores'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($parent !== null) { - $queryParams['parent'] = ObjectSerializer::toQueryValue($parent); - } - - // path params - if ($group !== null) { - $resourcePath = str_replace( - '{' . 'group' . '}', - ObjectSerializer::toPathValue($group), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getScore - * - * Get a score's metadata - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ScoreDetails - */ - public function getScore($score, $sharingKey = null) - { - list($response) = $this->getScoreWithHttpInfo($score, $sharingKey); - return $response; - } - - /** - * Operation getScoreWithHttpInfo - * - * Get a score's metadata - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ScoreDetails, HTTP status code, HTTP response headers (array of strings) - */ - public function getScoreWithHttpInfo($score, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails'; - $request = $this->getScoreRequest($score, $sharingKey); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ScoreDetails', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 402: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getScoreAsync - * - * Get a score's metadata - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getScoreAsync($score, $sharingKey = null) - { - return $this->getScoreAsyncWithHttpInfo($score, $sharingKey) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getScoreAsyncWithHttpInfo - * - * Get a score's metadata - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getScoreAsyncWithHttpInfo($score, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails'; - $request = $this->getScoreRequest($score, $sharingKey); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getScore' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getScoreRequest($score, $sharingKey = null) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling getScore' - ); - } - - $resourcePath = '/scores/{score}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($sharingKey !== null) { - $queryParams['sharingKey'] = ObjectSerializer::toQueryValue($sharingKey); - } - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getScoreCollaborator - * - * Get a collaborator - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $collaborator Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ResourceCollaborator - */ - public function getScoreCollaborator($score, $collaborator, $sharingKey = null) - { - list($response) = $this->getScoreCollaboratorWithHttpInfo($score, $collaborator, $sharingKey); - return $response; - } - - /** - * Operation getScoreCollaboratorWithHttpInfo - * - * Get a collaborator - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $collaborator Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ResourceCollaborator, HTTP status code, HTTP response headers (array of strings) - */ - public function getScoreCollaboratorWithHttpInfo($score, $collaborator, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\ResourceCollaborator'; - $request = $this->getScoreCollaboratorRequest($score, $collaborator, $sharingKey); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ResourceCollaborator', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 402: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getScoreCollaboratorAsync - * - * Get a collaborator - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $collaborator Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getScoreCollaboratorAsync($score, $collaborator, $sharingKey = null) - { - return $this->getScoreCollaboratorAsyncWithHttpInfo($score, $collaborator, $sharingKey) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getScoreCollaboratorAsyncWithHttpInfo - * - * Get a collaborator - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $collaborator Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getScoreCollaboratorAsyncWithHttpInfo($score, $collaborator, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\ResourceCollaborator'; - $request = $this->getScoreCollaboratorRequest($score, $collaborator, $sharingKey); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getScoreCollaborator' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $collaborator Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getScoreCollaboratorRequest($score, $collaborator, $sharingKey = null) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling getScoreCollaborator' - ); - } - // verify the required parameter 'collaborator' is set - if ($collaborator === null || (is_array($collaborator) && count($collaborator) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $collaborator when calling getScoreCollaborator' - ); - } - - $resourcePath = '/scores/{score}/collaborators/{collaborator}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($sharingKey !== null) { - $queryParams['sharingKey'] = ObjectSerializer::toQueryValue($sharingKey); - } - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - // path params - if ($collaborator !== null) { - $resourcePath = str_replace( - '{' . 'collaborator' . '}', - ObjectSerializer::toPathValue($collaborator), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getScoreCollaborators - * - * List the collaborators - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ResourceCollaborator[] - */ - public function getScoreCollaborators($score, $sharingKey = null) - { - list($response) = $this->getScoreCollaboratorsWithHttpInfo($score, $sharingKey); - return $response; - } - - /** - * Operation getScoreCollaboratorsWithHttpInfo - * - * List the collaborators - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ResourceCollaborator[], HTTP status code, HTTP response headers (array of strings) - */ - public function getScoreCollaboratorsWithHttpInfo($score, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\ResourceCollaborator[]'; - $request = $this->getScoreCollaboratorsRequest($score, $sharingKey); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ResourceCollaborator[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 402: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getScoreCollaboratorsAsync - * - * List the collaborators - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getScoreCollaboratorsAsync($score, $sharingKey = null) - { - return $this->getScoreCollaboratorsAsyncWithHttpInfo($score, $sharingKey) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getScoreCollaboratorsAsyncWithHttpInfo - * - * List the collaborators - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getScoreCollaboratorsAsyncWithHttpInfo($score, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\ResourceCollaborator[]'; - $request = $this->getScoreCollaboratorsRequest($score, $sharingKey); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getScoreCollaborators' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getScoreCollaboratorsRequest($score, $sharingKey = null) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling getScoreCollaborators' - ); - } - - $resourcePath = '/scores/{score}/collaborators'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($sharingKey !== null) { - $queryParams['sharingKey'] = ObjectSerializer::toQueryValue($sharingKey); - } - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getScoreComments - * - * List comments - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * @param string $type Filter the comments by type (optional) - * @param string $sort Sort (optional) - * @param string $direction Sort direction (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ScoreComment[] - */ - public function getScoreComments($score, $sharingKey = null, $type = null, $sort = null, $direction = null) - { - list($response) = $this->getScoreCommentsWithHttpInfo($score, $sharingKey, $type, $sort, $direction); - return $response; - } - - /** - * Operation getScoreCommentsWithHttpInfo - * - * List comments - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * @param string $type Filter the comments by type (optional) - * @param string $sort Sort (optional) - * @param string $direction Sort direction (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ScoreComment[], HTTP status code, HTTP response headers (array of strings) - */ - public function getScoreCommentsWithHttpInfo($score, $sharingKey = null, $type = null, $sort = null, $direction = null) - { - $returnType = '\Flat\APIClient\Model\ScoreComment[]'; - $request = $this->getScoreCommentsRequest($score, $sharingKey, $type, $sort, $direction); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ScoreComment[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 402: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getScoreCommentsAsync - * - * List comments - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * @param string $type Filter the comments by type (optional) - * @param string $sort Sort (optional) - * @param string $direction Sort direction (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getScoreCommentsAsync($score, $sharingKey = null, $type = null, $sort = null, $direction = null) - { - return $this->getScoreCommentsAsyncWithHttpInfo($score, $sharingKey, $type, $sort, $direction) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getScoreCommentsAsyncWithHttpInfo - * - * List comments - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * @param string $type Filter the comments by type (optional) - * @param string $sort Sort (optional) - * @param string $direction Sort direction (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getScoreCommentsAsyncWithHttpInfo($score, $sharingKey = null, $type = null, $sort = null, $direction = null) - { - $returnType = '\Flat\APIClient\Model\ScoreComment[]'; - $request = $this->getScoreCommentsRequest($score, $sharingKey, $type, $sort, $direction); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getScoreComments' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * @param string $type Filter the comments by type (optional) - * @param string $sort Sort (optional) - * @param string $direction Sort direction (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getScoreCommentsRequest($score, $sharingKey = null, $type = null, $sort = null, $direction = null) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling getScoreComments' - ); - } - - $resourcePath = '/scores/{score}/comments'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($sharingKey !== null) { - $queryParams['sharingKey'] = ObjectSerializer::toQueryValue($sharingKey); - } - // query params - if ($type !== null) { - $queryParams['type'] = ObjectSerializer::toQueryValue($type); - } - // query params - if ($sort !== null) { - $queryParams['sort'] = ObjectSerializer::toQueryValue($sort); - } - // query params - if ($direction !== null) { - $queryParams['direction'] = ObjectSerializer::toQueryValue($direction); - } - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getScoreRevision - * - * Get a score revision - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ScoreRevision - */ - public function getScoreRevision($score, $revision, $sharingKey = null) - { - list($response) = $this->getScoreRevisionWithHttpInfo($score, $revision, $sharingKey); - return $response; - } - - /** - * Operation getScoreRevisionWithHttpInfo - * - * Get a score revision - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ScoreRevision, HTTP status code, HTTP response headers (array of strings) - */ - public function getScoreRevisionWithHttpInfo($score, $revision, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\ScoreRevision'; - $request = $this->getScoreRevisionRequest($score, $revision, $sharingKey); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ScoreRevision', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 402: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getScoreRevisionAsync - * - * Get a score revision - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getScoreRevisionAsync($score, $revision, $sharingKey = null) - { - return $this->getScoreRevisionAsyncWithHttpInfo($score, $revision, $sharingKey) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getScoreRevisionAsyncWithHttpInfo - * - * Get a score revision - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getScoreRevisionAsyncWithHttpInfo($score, $revision, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\ScoreRevision'; - $request = $this->getScoreRevisionRequest($score, $revision, $sharingKey); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getScoreRevision' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getScoreRevisionRequest($score, $revision, $sharingKey = null) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling getScoreRevision' - ); - } - // verify the required parameter 'revision' is set - if ($revision === null || (is_array($revision) && count($revision) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $revision when calling getScoreRevision' - ); - } - - $resourcePath = '/scores/{score}/revisions/{revision}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($sharingKey !== null) { - $queryParams['sharingKey'] = ObjectSerializer::toQueryValue($sharingKey); - } - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - // path params - if ($revision !== null) { - $resourcePath = str_replace( - '{' . 'revision' . '}', - ObjectSerializer::toPathValue($revision), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getScoreRevisionData - * - * Get a score revision data - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) - * @param string $format The format of the file you will retrieve (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * @param string $parts An optional a set of parts to be exported. This parameter must be specified with a list of integers. For example \"1,2,5\". (optional) - * @param bool $onlyCached Only return files already generated and cached in Flat's production cache. If the file is not availabe, a 404 will be returned (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return string - */ - public function getScoreRevisionData($score, $revision, $format, $sharingKey = null, $parts = null, $onlyCached = null) - { - list($response) = $this->getScoreRevisionDataWithHttpInfo($score, $revision, $format, $sharingKey, $parts, $onlyCached); - return $response; - } - - /** - * Operation getScoreRevisionDataWithHttpInfo - * - * Get a score revision data - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) - * @param string $format The format of the file you will retrieve (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * @param string $parts An optional a set of parts to be exported. This parameter must be specified with a list of integers. For example \"1,2,5\". (optional) - * @param bool $onlyCached Only return files already generated and cached in Flat's production cache. If the file is not availabe, a 404 will be returned (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of string, HTTP status code, HTTP response headers (array of strings) - */ - public function getScoreRevisionDataWithHttpInfo($score, $revision, $format, $sharingKey = null, $parts = null, $onlyCached = null) - { - $returnType = 'string'; - $request = $this->getScoreRevisionDataRequest($score, $revision, $format, $sharingKey, $parts, $onlyCached); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - 'string', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 402: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getScoreRevisionDataAsync - * - * Get a score revision data - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) - * @param string $format The format of the file you will retrieve (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * @param string $parts An optional a set of parts to be exported. This parameter must be specified with a list of integers. For example \"1,2,5\". (optional) - * @param bool $onlyCached Only return files already generated and cached in Flat's production cache. If the file is not availabe, a 404 will be returned (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getScoreRevisionDataAsync($score, $revision, $format, $sharingKey = null, $parts = null, $onlyCached = null) - { - return $this->getScoreRevisionDataAsyncWithHttpInfo($score, $revision, $format, $sharingKey, $parts, $onlyCached) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getScoreRevisionDataAsyncWithHttpInfo - * - * Get a score revision data - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) - * @param string $format The format of the file you will retrieve (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * @param string $parts An optional a set of parts to be exported. This parameter must be specified with a list of integers. For example \"1,2,5\". (optional) - * @param bool $onlyCached Only return files already generated and cached in Flat's production cache. If the file is not availabe, a 404 will be returned (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getScoreRevisionDataAsyncWithHttpInfo($score, $revision, $format, $sharingKey = null, $parts = null, $onlyCached = null) - { - $returnType = 'string'; - $request = $this->getScoreRevisionDataRequest($score, $revision, $format, $sharingKey, $parts, $onlyCached); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getScoreRevisionData' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) - * @param string $format The format of the file you will retrieve (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * @param string $parts An optional a set of parts to be exported. This parameter must be specified with a list of integers. For example \"1,2,5\". (optional) - * @param bool $onlyCached Only return files already generated and cached in Flat's production cache. If the file is not availabe, a 404 will be returned (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getScoreRevisionDataRequest($score, $revision, $format, $sharingKey = null, $parts = null, $onlyCached = null) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling getScoreRevisionData' - ); - } - // verify the required parameter 'revision' is set - if ($revision === null || (is_array($revision) && count($revision) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $revision when calling getScoreRevisionData' - ); - } - // verify the required parameter 'format' is set - if ($format === null || (is_array($format) && count($format) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $format when calling getScoreRevisionData' - ); - } - - $resourcePath = '/scores/{score}/revisions/{revision}/{format}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($sharingKey !== null) { - $queryParams['sharingKey'] = ObjectSerializer::toQueryValue($sharingKey); - } - // query params - if ($parts !== null) { - $queryParams['parts'] = ObjectSerializer::toQueryValue($parts); - } - // query params - if ($onlyCached !== null) { - $queryParams['onlyCached'] = ObjectSerializer::toQueryValue($onlyCached); - } - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - // path params - if ($revision !== null) { - $resourcePath = str_replace( - '{' . 'revision' . '}', - ObjectSerializer::toPathValue($revision), - $resourcePath - ); - } - // path params - if ($format !== null) { - $resourcePath = str_replace( - '{' . 'format' . '}', - ObjectSerializer::toPathValue($format), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'application/vnd.recordare.musicxml+xml', 'application/vnd.recordare.musicxml', 'audio/mp3', 'audio/wav', 'audio/midi', 'image/png'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'application/vnd.recordare.musicxml+xml', 'application/vnd.recordare.musicxml', 'audio/mp3', 'audio/wav', 'audio/midi', 'image/png'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getScoreRevisions - * - * List the revisions - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ScoreRevision[] - */ - public function getScoreRevisions($score, $sharingKey = null) - { - list($response) = $this->getScoreRevisionsWithHttpInfo($score, $sharingKey); - return $response; - } - - /** - * Operation getScoreRevisionsWithHttpInfo - * - * List the revisions - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ScoreRevision[], HTTP status code, HTTP response headers (array of strings) - */ - public function getScoreRevisionsWithHttpInfo($score, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\ScoreRevision[]'; - $request = $this->getScoreRevisionsRequest($score, $sharingKey); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ScoreRevision[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 402: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getScoreRevisionsAsync - * - * List the revisions - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getScoreRevisionsAsync($score, $sharingKey = null) - { - return $this->getScoreRevisionsAsyncWithHttpInfo($score, $sharingKey) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getScoreRevisionsAsyncWithHttpInfo - * - * List the revisions - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getScoreRevisionsAsyncWithHttpInfo($score, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\ScoreRevision[]'; - $request = $this->getScoreRevisionsRequest($score, $sharingKey); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getScoreRevisions' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getScoreRevisionsRequest($score, $sharingKey = null) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling getScoreRevisions' - ); - } - - $resourcePath = '/scores/{score}/revisions'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($sharingKey !== null) { - $queryParams['sharingKey'] = ObjectSerializer::toQueryValue($sharingKey); - } - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getScoreSubmissions - * - * List submissions related to the score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\AssignmentSubmission[] - */ - public function getScoreSubmissions($score) - { - list($response) = $this->getScoreSubmissionsWithHttpInfo($score); - return $response; - } - - /** - * Operation getScoreSubmissionsWithHttpInfo - * - * List submissions related to the score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\AssignmentSubmission[], HTTP status code, HTTP response headers (array of strings) - */ - public function getScoreSubmissionsWithHttpInfo($score) - { - $returnType = '\Flat\APIClient\Model\AssignmentSubmission[]'; - $request = $this->getScoreSubmissionsRequest($score); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\AssignmentSubmission[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getScoreSubmissionsAsync - * - * List submissions related to the score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getScoreSubmissionsAsync($score) - { - return $this->getScoreSubmissionsAsyncWithHttpInfo($score) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getScoreSubmissionsAsyncWithHttpInfo - * - * List submissions related to the score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getScoreSubmissionsAsyncWithHttpInfo($score) - { - $returnType = '\Flat\APIClient\Model\AssignmentSubmission[]'; - $request = $this->getScoreSubmissionsRequest($score); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getScoreSubmissions' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getScoreSubmissionsRequest($score) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling getScoreSubmissions' - ); - } - - $resourcePath = '/scores/{score}/submissions'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getScoreTrack - * - * Retrieve the details of an audio or video track linked to a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $track Unique identifier of a score audio track (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ScoreTrack - */ - public function getScoreTrack($score, $track, $sharingKey = null) - { - list($response) = $this->getScoreTrackWithHttpInfo($score, $track, $sharingKey); - return $response; - } - - /** - * Operation getScoreTrackWithHttpInfo - * - * Retrieve the details of an audio or video track linked to a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $track Unique identifier of a score audio track (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ScoreTrack, HTTP status code, HTTP response headers (array of strings) - */ - public function getScoreTrackWithHttpInfo($score, $track, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\ScoreTrack'; - $request = $this->getScoreTrackRequest($score, $track, $sharingKey); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ScoreTrack', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getScoreTrackAsync - * - * Retrieve the details of an audio or video track linked to a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $track Unique identifier of a score audio track (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getScoreTrackAsync($score, $track, $sharingKey = null) - { - return $this->getScoreTrackAsyncWithHttpInfo($score, $track, $sharingKey) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getScoreTrackAsyncWithHttpInfo - * - * Retrieve the details of an audio or video track linked to a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $track Unique identifier of a score audio track (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getScoreTrackAsyncWithHttpInfo($score, $track, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\ScoreTrack'; - $request = $this->getScoreTrackRequest($score, $track, $sharingKey); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getScoreTrack' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $track Unique identifier of a score audio track (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getScoreTrackRequest($score, $track, $sharingKey = null) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling getScoreTrack' - ); - } - // verify the required parameter 'track' is set - if ($track === null || (is_array($track) && count($track) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $track when calling getScoreTrack' - ); - } - - $resourcePath = '/scores/{score}/tracks/{track}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($sharingKey !== null) { - $queryParams['sharingKey'] = ObjectSerializer::toQueryValue($sharingKey); - } - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - // path params - if ($track !== null) { - $resourcePath = str_replace( - '{' . 'track' . '}', - ObjectSerializer::toPathValue($track), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getUserScores - * - * List user's scores - * - * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - * @param string $parent Filter the score forked from the score id `parent` (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ScoreDetails[] - */ - public function getUserScores($user, $parent = null) - { - list($response) = $this->getUserScoresWithHttpInfo($user, $parent); - return $response; - } - - /** - * Operation getUserScoresWithHttpInfo - * - * List user's scores - * - * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - * @param string $parent Filter the score forked from the score id `parent` (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ScoreDetails[], HTTP status code, HTTP response headers (array of strings) - */ - public function getUserScoresWithHttpInfo($user, $parent = null) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails[]'; - $request = $this->getUserScoresRequest($user, $parent); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ScoreDetails[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getUserScoresAsync - * - * List user's scores - * - * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - * @param string $parent Filter the score forked from the score id `parent` (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getUserScoresAsync($user, $parent = null) - { - return $this->getUserScoresAsyncWithHttpInfo($user, $parent) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getUserScoresAsyncWithHttpInfo - * - * List user's scores - * - * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - * @param string $parent Filter the score forked from the score id `parent` (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getUserScoresAsyncWithHttpInfo($user, $parent = null) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails[]'; - $request = $this->getUserScoresRequest($user, $parent); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getUserScores' - * - * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - * @param string $parent Filter the score forked from the score id `parent` (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getUserScoresRequest($user, $parent = null) - { - // verify the required parameter 'user' is set - if ($user === null || (is_array($user) && count($user) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $user when calling getUserScores' - ); - } - - $resourcePath = '/users/{user}/scores'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($parent !== null) { - $queryParams['parent'] = ObjectSerializer::toQueryValue($parent); - } - - // path params - if ($user !== null) { - $resourcePath = str_replace( - '{' . 'user' . '}', - ObjectSerializer::toPathValue($user), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation listScoreTracks - * - * List the audio or video tracks linked to a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ScoreTrack[] - */ - public function listScoreTracks($score, $sharingKey = null) - { - list($response) = $this->listScoreTracksWithHttpInfo($score, $sharingKey); - return $response; - } - - /** - * Operation listScoreTracksWithHttpInfo - * - * List the audio or video tracks linked to a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ScoreTrack[], HTTP status code, HTTP response headers (array of strings) - */ - public function listScoreTracksWithHttpInfo($score, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\ScoreTrack[]'; - $request = $this->listScoreTracksRequest($score, $sharingKey); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ScoreTrack[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation listScoreTracksAsync - * - * List the audio or video tracks linked to a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function listScoreTracksAsync($score, $sharingKey = null) - { - return $this->listScoreTracksAsyncWithHttpInfo($score, $sharingKey) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation listScoreTracksAsyncWithHttpInfo - * - * List the audio or video tracks linked to a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function listScoreTracksAsyncWithHttpInfo($score, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\ScoreTrack[]'; - $request = $this->listScoreTracksRequest($score, $sharingKey); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'listScoreTracks' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function listScoreTracksRequest($score, $sharingKey = null) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling listScoreTracks' - ); - } - - $resourcePath = '/scores/{score}/tracks'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($sharingKey !== null) { - $queryParams['sharingKey'] = ObjectSerializer::toQueryValue($sharingKey); - } - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation markScoreCommentResolved - * - * Mark the comment as resolved - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $comment Unique identifier of a sheet music comment (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function markScoreCommentResolved($score, $comment, $sharingKey = null) - { - $this->markScoreCommentResolvedWithHttpInfo($score, $comment, $sharingKey); - } - - /** - * Operation markScoreCommentResolvedWithHttpInfo - * - * Mark the comment as resolved - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $comment Unique identifier of a sheet music comment (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function markScoreCommentResolvedWithHttpInfo($score, $comment, $sharingKey = null) - { - $returnType = ''; - $request = $this->markScoreCommentResolvedRequest($score, $comment, $sharingKey); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation markScoreCommentResolvedAsync - * - * Mark the comment as resolved - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $comment Unique identifier of a sheet music comment (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function markScoreCommentResolvedAsync($score, $comment, $sharingKey = null) - { - return $this->markScoreCommentResolvedAsyncWithHttpInfo($score, $comment, $sharingKey) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation markScoreCommentResolvedAsyncWithHttpInfo - * - * Mark the comment as resolved - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $comment Unique identifier of a sheet music comment (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function markScoreCommentResolvedAsyncWithHttpInfo($score, $comment, $sharingKey = null) - { - $returnType = ''; - $request = $this->markScoreCommentResolvedRequest($score, $comment, $sharingKey); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'markScoreCommentResolved' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $comment Unique identifier of a sheet music comment (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function markScoreCommentResolvedRequest($score, $comment, $sharingKey = null) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling markScoreCommentResolved' - ); - } - // verify the required parameter 'comment' is set - if ($comment === null || (is_array($comment) && count($comment) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $comment when calling markScoreCommentResolved' - ); - } - - $resourcePath = '/scores/{score}/comments/{comment}/resolved'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($sharingKey !== null) { - $queryParams['sharingKey'] = ObjectSerializer::toQueryValue($sharingKey); - } - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - // path params - if ($comment !== null) { - $resourcePath = str_replace( - '{' . 'comment' . '}', - ObjectSerializer::toPathValue($comment), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation markScoreCommentUnresolved - * - * Mark the comment as unresolved - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $comment Unique identifier of a sheet music comment (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function markScoreCommentUnresolved($score, $comment, $sharingKey = null) - { - $this->markScoreCommentUnresolvedWithHttpInfo($score, $comment, $sharingKey); - } - - /** - * Operation markScoreCommentUnresolvedWithHttpInfo - * - * Mark the comment as unresolved - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $comment Unique identifier of a sheet music comment (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function markScoreCommentUnresolvedWithHttpInfo($score, $comment, $sharingKey = null) - { - $returnType = ''; - $request = $this->markScoreCommentUnresolvedRequest($score, $comment, $sharingKey); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation markScoreCommentUnresolvedAsync - * - * Mark the comment as unresolved - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $comment Unique identifier of a sheet music comment (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function markScoreCommentUnresolvedAsync($score, $comment, $sharingKey = null) - { - return $this->markScoreCommentUnresolvedAsyncWithHttpInfo($score, $comment, $sharingKey) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation markScoreCommentUnresolvedAsyncWithHttpInfo - * - * Mark the comment as unresolved - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $comment Unique identifier of a sheet music comment (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function markScoreCommentUnresolvedAsyncWithHttpInfo($score, $comment, $sharingKey = null) - { - $returnType = ''; - $request = $this->markScoreCommentUnresolvedRequest($score, $comment, $sharingKey); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'markScoreCommentUnresolved' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $comment Unique identifier of a sheet music comment (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function markScoreCommentUnresolvedRequest($score, $comment, $sharingKey = null) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling markScoreCommentUnresolved' - ); - } - // verify the required parameter 'comment' is set - if ($comment === null || (is_array($comment) && count($comment) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $comment when calling markScoreCommentUnresolved' - ); - } - - $resourcePath = '/scores/{score}/comments/{comment}/resolved'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($sharingKey !== null) { - $queryParams['sharingKey'] = ObjectSerializer::toQueryValue($sharingKey); - } - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - // path params - if ($comment !== null) { - $resourcePath = str_replace( - '{' . 'comment' . '}', - ObjectSerializer::toPathValue($comment), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation postScoreComment - * - * Post a new comment - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreCommentCreation $body body (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ScoreComment - */ - public function postScoreComment($score, $body, $sharingKey = null) - { - list($response) = $this->postScoreCommentWithHttpInfo($score, $body, $sharingKey); - return $response; - } - - /** - * Operation postScoreCommentWithHttpInfo - * - * Post a new comment - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreCommentCreation $body (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ScoreComment, HTTP status code, HTTP response headers (array of strings) - */ - public function postScoreCommentWithHttpInfo($score, $body, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\ScoreComment'; - $request = $this->postScoreCommentRequest($score, $body, $sharingKey); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ScoreComment', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 402: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation postScoreCommentAsync - * - * Post a new comment - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreCommentCreation $body (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function postScoreCommentAsync($score, $body, $sharingKey = null) - { - return $this->postScoreCommentAsyncWithHttpInfo($score, $body, $sharingKey) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation postScoreCommentAsyncWithHttpInfo - * - * Post a new comment - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreCommentCreation $body (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function postScoreCommentAsyncWithHttpInfo($score, $body, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\ScoreComment'; - $request = $this->postScoreCommentRequest($score, $body, $sharingKey); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'postScoreComment' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param \Flat\APIClient\Model\ScoreCommentCreation $body (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function postScoreCommentRequest($score, $body, $sharingKey = null) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling postScoreComment' - ); - } - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling postScoreComment' - ); - } - - $resourcePath = '/scores/{score}/comments'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($sharingKey !== null) { - $queryParams['sharingKey'] = ObjectSerializer::toQueryValue($sharingKey); - } - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation removeScoreCollaborator - * - * Delete a collaborator - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $collaborator Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function removeScoreCollaborator($score, $collaborator) - { - $this->removeScoreCollaboratorWithHttpInfo($score, $collaborator); - } - - /** - * Operation removeScoreCollaboratorWithHttpInfo - * - * Delete a collaborator - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $collaborator Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function removeScoreCollaboratorWithHttpInfo($score, $collaborator) - { - $returnType = ''; - $request = $this->removeScoreCollaboratorRequest($score, $collaborator); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation removeScoreCollaboratorAsync - * - * Delete a collaborator - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $collaborator Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function removeScoreCollaboratorAsync($score, $collaborator) - { - return $this->removeScoreCollaboratorAsyncWithHttpInfo($score, $collaborator) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation removeScoreCollaboratorAsyncWithHttpInfo - * - * Delete a collaborator - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $collaborator Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function removeScoreCollaboratorAsyncWithHttpInfo($score, $collaborator) - { - $returnType = ''; - $request = $this->removeScoreCollaboratorRequest($score, $collaborator); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'removeScoreCollaborator' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $collaborator Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function removeScoreCollaboratorRequest($score, $collaborator) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling removeScoreCollaborator' - ); - } - // verify the required parameter 'collaborator' is set - if ($collaborator === null || (is_array($collaborator) && count($collaborator) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $collaborator when calling removeScoreCollaborator' - ); - } - - $resourcePath = '/scores/{score}/collaborators/{collaborator}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - // path params - if ($collaborator !== null) { - $resourcePath = str_replace( - '{' . 'collaborator' . '}', - ObjectSerializer::toPathValue($collaborator), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation untrashScore - * - * Untrash a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function untrashScore($score) - { - $this->untrashScoreWithHttpInfo($score); - } - - /** - * Operation untrashScoreWithHttpInfo - * - * Untrash a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function untrashScoreWithHttpInfo($score) - { - $returnType = ''; - $request = $this->untrashScoreRequest($score); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation untrashScoreAsync - * - * Untrash a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function untrashScoreAsync($score) - { - return $this->untrashScoreAsyncWithHttpInfo($score) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation untrashScoreAsyncWithHttpInfo - * - * Untrash a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function untrashScoreAsyncWithHttpInfo($score) - { - $returnType = ''; - $request = $this->untrashScoreRequest($score); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'untrashScore' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function untrashScoreRequest($score) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling untrashScore' - ); - } - - $resourcePath = '/scores/{score}/untrash'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation updateScoreComment - * - * Update an existing comment - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $comment Unique identifier of a sheet music comment (required) - * @param \Flat\APIClient\Model\ScoreCommentUpdate $body body (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ScoreComment - */ - public function updateScoreComment($score, $comment, $body, $sharingKey = null) - { - list($response) = $this->updateScoreCommentWithHttpInfo($score, $comment, $body, $sharingKey); - return $response; - } - - /** - * Operation updateScoreCommentWithHttpInfo - * - * Update an existing comment - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $comment Unique identifier of a sheet music comment (required) - * @param \Flat\APIClient\Model\ScoreCommentUpdate $body (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ScoreComment, HTTP status code, HTTP response headers (array of strings) - */ - public function updateScoreCommentWithHttpInfo($score, $comment, $body, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\ScoreComment'; - $request = $this->updateScoreCommentRequest($score, $comment, $body, $sharingKey); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ScoreComment', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 402: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation updateScoreCommentAsync - * - * Update an existing comment - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $comment Unique identifier of a sheet music comment (required) - * @param \Flat\APIClient\Model\ScoreCommentUpdate $body (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateScoreCommentAsync($score, $comment, $body, $sharingKey = null) - { - return $this->updateScoreCommentAsyncWithHttpInfo($score, $comment, $body, $sharingKey) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateScoreCommentAsyncWithHttpInfo - * - * Update an existing comment - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $comment Unique identifier of a sheet music comment (required) - * @param \Flat\APIClient\Model\ScoreCommentUpdate $body (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateScoreCommentAsyncWithHttpInfo($score, $comment, $body, $sharingKey = null) - { - $returnType = '\Flat\APIClient\Model\ScoreComment'; - $request = $this->updateScoreCommentRequest($score, $comment, $body, $sharingKey); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'updateScoreComment' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $comment Unique identifier of a sheet music comment (required) - * @param \Flat\APIClient\Model\ScoreCommentUpdate $body (required) - * @param string $sharingKey This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function updateScoreCommentRequest($score, $comment, $body, $sharingKey = null) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling updateScoreComment' - ); - } - // verify the required parameter 'comment' is set - if ($comment === null || (is_array($comment) && count($comment) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $comment when calling updateScoreComment' - ); - } - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling updateScoreComment' - ); - } - - $resourcePath = '/scores/{score}/comments/{comment}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($sharingKey !== null) { - $queryParams['sharingKey'] = ObjectSerializer::toQueryValue($sharingKey); - } - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - // path params - if ($comment !== null) { - $resourcePath = str_replace( - '{' . 'comment' . '}', - ObjectSerializer::toPathValue($comment), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation updateScoreTrack - * - * Update an audio or video track linked to a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $track Unique identifier of a score audio track (required) - * @param \Flat\APIClient\Model\ScoreTrackUpdate $body body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ScoreTrack - */ - public function updateScoreTrack($score, $track, $body) - { - list($response) = $this->updateScoreTrackWithHttpInfo($score, $track, $body); - return $response; - } - - /** - * Operation updateScoreTrackWithHttpInfo - * - * Update an audio or video track linked to a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $track Unique identifier of a score audio track (required) - * @param \Flat\APIClient\Model\ScoreTrackUpdate $body (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ScoreTrack, HTTP status code, HTTP response headers (array of strings) - */ - public function updateScoreTrackWithHttpInfo($score, $track, $body) - { - $returnType = '\Flat\APIClient\Model\ScoreTrack'; - $request = $this->updateScoreTrackRequest($score, $track, $body); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ScoreTrack', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation updateScoreTrackAsync - * - * Update an audio or video track linked to a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $track Unique identifier of a score audio track (required) - * @param \Flat\APIClient\Model\ScoreTrackUpdate $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateScoreTrackAsync($score, $track, $body) - { - return $this->updateScoreTrackAsyncWithHttpInfo($score, $track, $body) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateScoreTrackAsyncWithHttpInfo - * - * Update an audio or video track linked to a score - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $track Unique identifier of a score audio track (required) - * @param \Flat\APIClient\Model\ScoreTrackUpdate $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateScoreTrackAsyncWithHttpInfo($score, $track, $body) - { - $returnType = '\Flat\APIClient\Model\ScoreTrack'; - $request = $this->updateScoreTrackRequest($score, $track, $body); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'updateScoreTrack' - * - * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - * @param string $track Unique identifier of a score audio track (required) - * @param \Flat\APIClient\Model\ScoreTrackUpdate $body (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function updateScoreTrackRequest($score, $track, $body) - { - // verify the required parameter 'score' is set - if ($score === null || (is_array($score) && count($score) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $score when calling updateScoreTrack' - ); - } - // verify the required parameter 'track' is set - if ($track === null || (is_array($track) && count($track) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $track when calling updateScoreTrack' - ); - } - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling updateScoreTrack' - ); - } - - $resourcePath = '/scores/{score}/tracks/{track}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($score !== null) { - $resourcePath = str_replace( - '{' . 'score' . '}', - ObjectSerializer::toPathValue($score), - $resourcePath - ); - } - // path params - if ($track !== null) { - $resourcePath = str_replace( - '{' . 'track' . '}', - ObjectSerializer::toPathValue($track), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/lib/Api/UserApi.php b/lib/Api/UserApi.php deleted file mode 100644 index b1e9c52..0000000 --- a/lib/Api/UserApi.php +++ /dev/null @@ -1,948 +0,0 @@ -client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation gerUserLikes - * - * List liked scores - * - * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - * @param bool $ids Return only the identifiers of the scores (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ScoreDetails[] - */ - public function gerUserLikes($user, $ids = null) - { - list($response) = $this->gerUserLikesWithHttpInfo($user, $ids); - return $response; - } - - /** - * Operation gerUserLikesWithHttpInfo - * - * List liked scores - * - * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - * @param bool $ids Return only the identifiers of the scores (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ScoreDetails[], HTTP status code, HTTP response headers (array of strings) - */ - public function gerUserLikesWithHttpInfo($user, $ids = null) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails[]'; - $request = $this->gerUserLikesRequest($user, $ids); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ScoreDetails[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation gerUserLikesAsync - * - * List liked scores - * - * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - * @param bool $ids Return only the identifiers of the scores (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function gerUserLikesAsync($user, $ids = null) - { - return $this->gerUserLikesAsyncWithHttpInfo($user, $ids) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation gerUserLikesAsyncWithHttpInfo - * - * List liked scores - * - * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - * @param bool $ids Return only the identifiers of the scores (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function gerUserLikesAsyncWithHttpInfo($user, $ids = null) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails[]'; - $request = $this->gerUserLikesRequest($user, $ids); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'gerUserLikes' - * - * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - * @param bool $ids Return only the identifiers of the scores (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function gerUserLikesRequest($user, $ids = null) - { - // verify the required parameter 'user' is set - if ($user === null || (is_array($user) && count($user) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $user when calling gerUserLikes' - ); - } - - $resourcePath = '/users/{user}/likes'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($ids !== null) { - $queryParams['ids'] = ObjectSerializer::toQueryValue($ids); - } - - // path params - if ($user !== null) { - $resourcePath = str_replace( - '{' . 'user' . '}', - ObjectSerializer::toPathValue($user), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getUser - * - * Get a public user profile - * - * @param string $user This route parameter is the unique identifier of the user. You can specify an email instead of an unique identifier. If you are executing this request authenticated, you can use `me` as a value instead of the current User unique identifier to work on the current authenticated user. (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\UserPublic - */ - public function getUser($user) - { - list($response) = $this->getUserWithHttpInfo($user); - return $response; - } - - /** - * Operation getUserWithHttpInfo - * - * Get a public user profile - * - * @param string $user This route parameter is the unique identifier of the user. You can specify an email instead of an unique identifier. If you are executing this request authenticated, you can use `me` as a value instead of the current User unique identifier to work on the current authenticated user. (required) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\UserPublic, HTTP status code, HTTP response headers (array of strings) - */ - public function getUserWithHttpInfo($user) - { - $returnType = '\Flat\APIClient\Model\UserPublic'; - $request = $this->getUserRequest($user); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\UserPublic', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getUserAsync - * - * Get a public user profile - * - * @param string $user This route parameter is the unique identifier of the user. You can specify an email instead of an unique identifier. If you are executing this request authenticated, you can use `me` as a value instead of the current User unique identifier to work on the current authenticated user. (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getUserAsync($user) - { - return $this->getUserAsyncWithHttpInfo($user) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getUserAsyncWithHttpInfo - * - * Get a public user profile - * - * @param string $user This route parameter is the unique identifier of the user. You can specify an email instead of an unique identifier. If you are executing this request authenticated, you can use `me` as a value instead of the current User unique identifier to work on the current authenticated user. (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getUserAsyncWithHttpInfo($user) - { - $returnType = '\Flat\APIClient\Model\UserPublic'; - $request = $this->getUserRequest($user); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getUser' - * - * @param string $user This route parameter is the unique identifier of the user. You can specify an email instead of an unique identifier. If you are executing this request authenticated, you can use `me` as a value instead of the current User unique identifier to work on the current authenticated user. (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getUserRequest($user) - { - // verify the required parameter 'user' is set - if ($user === null || (is_array($user) && count($user) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $user when calling getUser' - ); - } - - $resourcePath = '/users/{user}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // path params - if ($user !== null) { - $resourcePath = str_replace( - '{' . 'user' . '}', - ObjectSerializer::toPathValue($user), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getUserScores - * - * List user's scores - * - * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - * @param string $parent Filter the score forked from the score id `parent` (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Flat\APIClient\Model\ScoreDetails[] - */ - public function getUserScores($user, $parent = null) - { - list($response) = $this->getUserScoresWithHttpInfo($user, $parent); - return $response; - } - - /** - * Operation getUserScoresWithHttpInfo - * - * List user's scores - * - * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - * @param string $parent Filter the score forked from the score id `parent` (optional) - * - * @throws \Flat\APIClient\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Flat\APIClient\Model\ScoreDetails[], HTTP status code, HTTP response headers (array of strings) - */ - public function getUserScoresWithHttpInfo($user, $parent = null) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails[]'; - $request = $this->getUserScoresRequest($user, $parent); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\ScoreDetails[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Flat\APIClient\Model\FlatErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getUserScoresAsync - * - * List user's scores - * - * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - * @param string $parent Filter the score forked from the score id `parent` (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getUserScoresAsync($user, $parent = null) - { - return $this->getUserScoresAsyncWithHttpInfo($user, $parent) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getUserScoresAsyncWithHttpInfo - * - * List user's scores - * - * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - * @param string $parent Filter the score forked from the score id `parent` (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getUserScoresAsyncWithHttpInfo($user, $parent = null) - { - $returnType = '\Flat\APIClient\Model\ScoreDetails[]'; - $request = $this->getUserScoresRequest($user, $parent); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getUserScores' - * - * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - * @param string $parent Filter the score forked from the score id `parent` (optional) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function getUserScoresRequest($user, $parent = null) - { - // verify the required parameter 'user' is set - if ($user === null || (is_array($user) && count($user) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $user when calling getUserScores' - ); - } - - $resourcePath = '/users/{user}/scores'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if ($parent !== null) { - $queryParams['parent'] = ObjectSerializer::toQueryValue($parent); - } - - // path params - if ($user !== null) { - $resourcePath = str_replace( - '{' . 'user' . '}', - ObjectSerializer::toPathValue($user), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/lib/ApiException.php b/lib/ApiException.php deleted file mode 100644 index 86c7fd4..0000000 --- a/lib/ApiException.php +++ /dev/null @@ -1,121 +0,0 @@ -responseHeaders = $responseHeaders; - $this->responseBody = $responseBody; - } - - /** - * Gets the HTTP response header - * - * @return string[]|null HTTP response header - */ - public function getResponseHeaders() - { - return $this->responseHeaders; - } - - /** - * Gets the HTTP body of the server response either as Json or string - * - * @return mixed HTTP body of the server response either as \stdClass or string - */ - public function getResponseBody() - { - return $this->responseBody; - } - - /** - * Sets the deseralized response object (during deserialization) - * - * @param mixed $obj Deserialized response object - * - * @return void - */ - public function setResponseObject($obj) - { - $this->responseObject = $obj; - } - - /** - * Gets the deseralized response object (during deserialization) - * - * @return mixed the deserialized response object - */ - public function getResponseObject() - { - return $this->responseObject; - } -} diff --git a/lib/Configuration.php b/lib/Configuration.php deleted file mode 100644 index d6aa3d5..0000000 --- a/lib/Configuration.php +++ /dev/null @@ -1,430 +0,0 @@ -tempFolderPath = sys_get_temp_dir(); - } - - /** - * Sets API key - * - * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * @param string $key API key or token - * - * @return $this - */ - public function setApiKey($apiKeyIdentifier, $key) - { - $this->apiKeys[$apiKeyIdentifier] = $key; - return $this; - } - - /** - * Gets API key - * - * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * - * @return string API key or token - */ - public function getApiKey($apiKeyIdentifier) - { - return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; - } - - /** - * Sets the prefix for API key (e.g. Bearer) - * - * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * @param string $prefix API key prefix, e.g. Bearer - * - * @return $this - */ - public function setApiKeyPrefix($apiKeyIdentifier, $prefix) - { - $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; - return $this; - } - - /** - * Gets API key prefix - * - * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * - * @return string - */ - public function getApiKeyPrefix($apiKeyIdentifier) - { - return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; - } - - /** - * Sets the access token for OAuth - * - * @param string $accessToken Token for OAuth - * - * @return $this - */ - public function setAccessToken($accessToken) - { - $this->accessToken = $accessToken; - return $this; - } - - /** - * Gets the access token for OAuth - * - * @return string Access token for OAuth - */ - public function getAccessToken() - { - return $this->accessToken; - } - - /** - * Sets the username for HTTP basic authentication - * - * @param string $username Username for HTTP basic authentication - * - * @return $this - */ - public function setUsername($username) - { - $this->username = $username; - return $this; - } - - /** - * Gets the username for HTTP basic authentication - * - * @return string Username for HTTP basic authentication - */ - public function getUsername() - { - return $this->username; - } - - /** - * Sets the password for HTTP basic authentication - * - * @param string $password Password for HTTP basic authentication - * - * @return $this - */ - public function setPassword($password) - { - $this->password = $password; - return $this; - } - - /** - * Gets the password for HTTP basic authentication - * - * @return string Password for HTTP basic authentication - */ - public function getPassword() - { - return $this->password; - } - - /** - * Sets the host - * - * @param string $host Host - * - * @return $this - */ - public function setHost($host) - { - $this->host = $host; - return $this; - } - - /** - * Gets the host - * - * @return string Host - */ - public function getHost() - { - return $this->host; - } - - /** - * Sets the user agent of the api client - * - * @param string $userAgent the user agent of the api client - * - * @throws \InvalidArgumentException - * @return $this - */ - public function setUserAgent($userAgent) - { - if (!is_string($userAgent)) { - throw new \InvalidArgumentException('User-agent must be a string.'); - } - - $this->userAgent = $userAgent; - return $this; - } - - /** - * Gets the user agent of the api client - * - * @return string user agent - */ - public function getUserAgent() - { - return $this->userAgent; - } - - /** - * Sets debug flag - * - * @param bool $debug Debug flag - * - * @return $this - */ - public function setDebug($debug) - { - $this->debug = $debug; - return $this; - } - - /** - * Gets the debug flag - * - * @return bool - */ - public function getDebug() - { - return $this->debug; - } - - /** - * Sets the debug file - * - * @param string $debugFile Debug file - * - * @return $this - */ - public function setDebugFile($debugFile) - { - $this->debugFile = $debugFile; - return $this; - } - - /** - * Gets the debug file - * - * @return string - */ - public function getDebugFile() - { - return $this->debugFile; - } - - /** - * Sets the temp folder path - * - * @param string $tempFolderPath Temp folder path - * - * @return $this - */ - public function setTempFolderPath($tempFolderPath) - { - $this->tempFolderPath = $tempFolderPath; - return $this; - } - - /** - * Gets the temp folder path - * - * @return string Temp folder path - */ - public function getTempFolderPath() - { - return $this->tempFolderPath; - } - - /** - * Gets the default configuration instance - * - * @return Configuration - */ - public static function getDefaultConfiguration() - { - if (self::$defaultConfiguration === null) { - self::$defaultConfiguration = new Configuration(); - } - - return self::$defaultConfiguration; - } - - /** - * Sets the detault configuration instance - * - * @param Configuration $config An instance of the Configuration Object - * - * @return void - */ - public static function setDefaultConfiguration(Configuration $config) - { - self::$defaultConfiguration = $config; - } - - /** - * Gets the essential information for debugging - * - * @return string The report for debugging - */ - public static function toDebugReport() - { - $report = 'PHP SDK (Flat\APIClient) Debug Report:' . PHP_EOL; - $report .= ' OS: ' . php_uname() . PHP_EOL; - $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; - $report .= ' OpenAPI Spec Version: 2.6.0' . PHP_EOL; - $report .= ' SDK Package Version: 0.6.0' . PHP_EOL; - $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; - - return $report; - } - - /** - * Get API key (with prefix if set) - * - * @param string $apiKeyIdentifier name of apikey - * - * @return string API key with the prefix - */ - public function getApiKeyWithPrefix($apiKeyIdentifier) - { - $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); - $apiKey = $this->getApiKey($apiKeyIdentifier); - - if ($apiKey === null) { - return null; - } - - if ($prefix === null) { - $keyWithPrefix = $apiKey; - } else { - $keyWithPrefix = $prefix . ' ' . $apiKey; - } - - return $keyWithPrefix; - } -} diff --git a/lib/HeaderSelector.php b/lib/HeaderSelector.php deleted file mode 100644 index eb0d163..0000000 --- a/lib/HeaderSelector.php +++ /dev/null @@ -1,110 +0,0 @@ -selectAcceptHeader($accept); - if ($accept !== null) { - $headers['Accept'] = $accept; - } - - $headers['Content-Type'] = $this->selectContentTypeHeader($contentTypes); - return $headers; - } - - /** - * @param string[] $accept - * @return array - */ - public function selectHeadersForMultipart($accept) - { - $headers = $this->selectHeaders($accept, []); - - unset($headers['Content-Type']); - return $headers; - } - - /** - * Return the header 'Accept' based on an array of Accept provided - * - * @param string[] $accept Array of header - * - * @return string Accept (e.g. application/json) - */ - private function selectAcceptHeader($accept) - { - if (count($accept) === 0 || (count($accept) === 1 && $accept[0] === '')) { - return null; - } elseif (preg_grep("/application\/json/i", $accept)) { - return 'application/json'; - } else { - return implode(',', $accept); - } - } - - /** - * Return the content type based on an array of content-type provided - * - * @param string[] $contentType Array fo content-type - * - * @return string Content-Type (e.g. application/json) - */ - private function selectContentTypeHeader($contentType) - { - if (count($contentType) === 0 || (count($contentType) === 1 && $contentType[0] === '')) { - return 'application/json'; - } elseif (preg_grep("/application\/json/i", $contentType)) { - return 'application/json'; - } else { - return implode(',', $contentType); - } - } -} - diff --git a/lib/Model/Assignment.php b/lib/Model/Assignment.php deleted file mode 100644 index b9710f4..0000000 --- a/lib/Model/Assignment.php +++ /dev/null @@ -1,636 +0,0 @@ - 'string', - 'title' => 'string', - 'classroom' => 'string', - 'description' => 'string', - 'attachments' => '\Flat\APIClient\Model\MediaAttachment[]', - 'submissions' => '\Flat\APIClient\Model\AssignmentSubmission[]', - 'creator' => 'string', - 'creationDate' => '\DateTime', - 'scheduledDate' => '\DateTime', - 'dueDate' => '\DateTime', - 'googleClassroom' => '\Flat\APIClient\Model\GoogleClassroomCoursework' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'state' => null, - 'title' => null, - 'classroom' => null, - 'description' => null, - 'attachments' => null, - 'submissions' => null, - 'creator' => null, - 'creationDate' => 'date-time', - 'scheduledDate' => 'date-time', - 'dueDate' => 'date-time', - 'googleClassroom' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'state' => 'state', - 'title' => 'title', - 'classroom' => 'classroom', - 'description' => 'description', - 'attachments' => 'attachments', - 'submissions' => 'submissions', - 'creator' => 'creator', - 'creationDate' => 'creationDate', - 'scheduledDate' => 'scheduledDate', - 'dueDate' => 'dueDate', - 'googleClassroom' => 'googleClassroom' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'state' => 'setState', - 'title' => 'setTitle', - 'classroom' => 'setClassroom', - 'description' => 'setDescription', - 'attachments' => 'setAttachments', - 'submissions' => 'setSubmissions', - 'creator' => 'setCreator', - 'creationDate' => 'setCreationDate', - 'scheduledDate' => 'setScheduledDate', - 'dueDate' => 'setDueDate', - 'googleClassroom' => 'setGoogleClassroom' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'state' => 'getState', - 'title' => 'getTitle', - 'classroom' => 'getClassroom', - 'description' => 'getDescription', - 'attachments' => 'getAttachments', - 'submissions' => 'getSubmissions', - 'creator' => 'getCreator', - 'creationDate' => 'getCreationDate', - 'scheduledDate' => 'getScheduledDate', - 'dueDate' => 'getDueDate', - 'googleClassroom' => 'getGoogleClassroom' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const STATE_DRAFT = 'draft'; - const STATE_ACTIVE = 'active'; - const STATE_ARCHIVED = 'archived'; - - - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getStateAllowableValues() - { - return [ - self::STATE_DRAFT, - self::STATE_ACTIVE, - self::STATE_ARCHIVED, - ]; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['state'] = isset($data['state']) ? $data['state'] : null; - $this->container['title'] = isset($data['title']) ? $data['title'] : null; - $this->container['classroom'] = isset($data['classroom']) ? $data['classroom'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; - $this->container['attachments'] = isset($data['attachments']) ? $data['attachments'] : null; - $this->container['submissions'] = isset($data['submissions']) ? $data['submissions'] : null; - $this->container['creator'] = isset($data['creator']) ? $data['creator'] : null; - $this->container['creationDate'] = isset($data['creationDate']) ? $data['creationDate'] : null; - $this->container['scheduledDate'] = isset($data['scheduledDate']) ? $data['scheduledDate'] : null; - $this->container['dueDate'] = isset($data['dueDate']) ? $data['dueDate'] : null; - $this->container['googleClassroom'] = isset($data['googleClassroom']) ? $data['googleClassroom'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - $allowedValues = $this->getStateAllowableValues(); - if (!is_null($this->container['state']) && !in_array($this->container['state'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value for 'state', must be one of '%s'", - implode("', '", $allowedValues) - ); - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets state - * - * @return string - */ - public function getState() - { - return $this->container['state']; - } - - /** - * Sets state - * - * @param string $state State of the assignment - * - * @return $this - */ - public function setState($state) - { - $allowedValues = $this->getStateAllowableValues(); - if (!is_null($state) && !in_array($state, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'state', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); - } - $this->container['state'] = $state; - - return $this; - } - - /** - * Gets title - * - * @return string - */ - public function getTitle() - { - return $this->container['title']; - } - - /** - * Sets title - * - * @param string $title Title of the assignment - * - * @return $this - */ - public function setTitle($title) - { - $this->container['title'] = $title; - - return $this; - } - - /** - * Gets classroom - * - * @return string - */ - public function getClassroom() - { - return $this->container['classroom']; - } - - /** - * Sets classroom - * - * @param string $classroom The unique identifier of the class where this assignment was posted - * - * @return $this - */ - public function setClassroom($classroom) - { - $this->container['classroom'] = $classroom; - - return $this; - } - - /** - * Gets description - * - * @return string - */ - public function getDescription() - { - return $this->container['description']; - } - - /** - * Sets description - * - * @param string $description Description and content of the assignment - * - * @return $this - */ - public function setDescription($description) - { - $this->container['description'] = $description; - - return $this; - } - - /** - * Gets attachments - * - * @return \Flat\APIClient\Model\MediaAttachment[] - */ - public function getAttachments() - { - return $this->container['attachments']; - } - - /** - * Sets attachments - * - * @param \Flat\APIClient\Model\MediaAttachment[] $attachments attachments - * - * @return $this - */ - public function setAttachments($attachments) - { - $this->container['attachments'] = $attachments; - - return $this; - } - - /** - * Gets submissions - * - * @return \Flat\APIClient\Model\AssignmentSubmission[] - */ - public function getSubmissions() - { - return $this->container['submissions']; - } - - /** - * Sets submissions - * - * @param \Flat\APIClient\Model\AssignmentSubmission[] $submissions submissions - * - * @return $this - */ - public function setSubmissions($submissions) - { - $this->container['submissions'] = $submissions; - - return $this; - } - - /** - * Gets creator - * - * @return string - */ - public function getCreator() - { - return $this->container['creator']; - } - - /** - * Sets creator - * - * @param string $creator The User unique identifier of the creator of this assignment - * - * @return $this - */ - public function setCreator($creator) - { - $this->container['creator'] = $creator; - - return $this; - } - - /** - * Gets creationDate - * - * @return \DateTime - */ - public function getCreationDate() - { - return $this->container['creationDate']; - } - - /** - * Sets creationDate - * - * @param \DateTime $creationDate The creation date of this assignment - * - * @return $this - */ - public function setCreationDate($creationDate) - { - $this->container['creationDate'] = $creationDate; - - return $this; - } - - /** - * Gets scheduledDate - * - * @return \DateTime - */ - public function getScheduledDate() - { - return $this->container['scheduledDate']; - } - - /** - * Sets scheduledDate - * - * @param \DateTime $scheduledDate The publication (scheduled) date of the assignment. If this one is specified, the assignment will only be listed to the teachers of the class. - * - * @return $this - */ - public function setScheduledDate($scheduledDate) - { - $this->container['scheduledDate'] = $scheduledDate; - - return $this; - } - - /** - * Gets dueDate - * - * @return \DateTime - */ - public function getDueDate() - { - return $this->container['dueDate']; - } - - /** - * Sets dueDate - * - * @param \DateTime $dueDate The due date of this assignment, late submissions will be marked as paste due. - * - * @return $this - */ - public function setDueDate($dueDate) - { - $this->container['dueDate'] = $dueDate; - - return $this; - } - - /** - * Gets googleClassroom - * - * @return \Flat\APIClient\Model\GoogleClassroomCoursework - */ - public function getGoogleClassroom() - { - return $this->container['googleClassroom']; - } - - /** - * Sets googleClassroom - * - * @param \Flat\APIClient\Model\GoogleClassroomCoursework $googleClassroom googleClassroom - * - * @return $this - */ - public function setGoogleClassroom($googleClassroom) - { - $this->container['googleClassroom'] = $googleClassroom; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/AssignmentCopy.php b/lib/Model/AssignmentCopy.php deleted file mode 100644 index c529f05..0000000 --- a/lib/Model/AssignmentCopy.php +++ /dev/null @@ -1,305 +0,0 @@ - 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'classroom' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'classroom' => 'classroom' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'classroom' => 'setClassroom' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'classroom' => 'getClassroom' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['classroom'] = isset($data['classroom']) ? $data['classroom'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['classroom'] === null) { - $invalidProperties[] = "'classroom' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets classroom - * - * @return string - */ - public function getClassroom() - { - return $this->container['classroom']; - } - - /** - * Sets classroom - * - * @param string $classroom The destination classroom where the assignment will be copied - * - * @return $this - */ - public function setClassroom($classroom) - { - $this->container['classroom'] = $classroom; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/AssignmentCreation.php b/lib/Model/AssignmentCreation.php deleted file mode 100644 index 1455fd0..0000000 --- a/lib/Model/AssignmentCreation.php +++ /dev/null @@ -1,422 +0,0 @@ - 'string', - 'description' => 'string', - 'attachments' => '\Flat\APIClient\Model\ClassAttachmentCreation[]', - 'dueDate' => '\DateTime', - 'scheduledDate' => '\DateTime' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'title' => null, - 'description' => null, - 'attachments' => null, - 'dueDate' => 'date-time', - 'scheduledDate' => 'date-time' - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'title' => 'title', - 'description' => 'description', - 'attachments' => 'attachments', - 'dueDate' => 'dueDate', - 'scheduledDate' => 'scheduledDate' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'title' => 'setTitle', - 'description' => 'setDescription', - 'attachments' => 'setAttachments', - 'dueDate' => 'setDueDate', - 'scheduledDate' => 'setScheduledDate' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'title' => 'getTitle', - 'description' => 'getDescription', - 'attachments' => 'getAttachments', - 'dueDate' => 'getDueDate', - 'scheduledDate' => 'getScheduledDate' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['title'] = isset($data['title']) ? $data['title'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; - $this->container['attachments'] = isset($data['attachments']) ? $data['attachments'] : null; - $this->container['dueDate'] = isset($data['dueDate']) ? $data['dueDate'] : null; - $this->container['scheduledDate'] = isset($data['scheduledDate']) ? $data['scheduledDate'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets title - * - * @return string - */ - public function getTitle() - { - return $this->container['title']; - } - - /** - * Sets title - * - * @param string $title Title of the assignment - * - * @return $this - */ - public function setTitle($title) - { - $this->container['title'] = $title; - - return $this; - } - - /** - * Gets description - * - * @return string - */ - public function getDescription() - { - return $this->container['description']; - } - - /** - * Sets description - * - * @param string $description Description and content of the assignment - * - * @return $this - */ - public function setDescription($description) - { - $this->container['description'] = $description; - - return $this; - } - - /** - * Gets attachments - * - * @return \Flat\APIClient\Model\ClassAttachmentCreation[] - */ - public function getAttachments() - { - return $this->container['attachments']; - } - - /** - * Sets attachments - * - * @param \Flat\APIClient\Model\ClassAttachmentCreation[] $attachments attachments - * - * @return $this - */ - public function setAttachments($attachments) - { - $this->container['attachments'] = $attachments; - - return $this; - } - - /** - * Gets dueDate - * - * @return \DateTime - */ - public function getDueDate() - { - return $this->container['dueDate']; - } - - /** - * Sets dueDate - * - * @param \DateTime $dueDate The due date of this assignment, late submissions will be marked as paste due. If not set, the assignment won't have a due date. - * - * @return $this - */ - public function setDueDate($dueDate) - { - $this->container['dueDate'] = $dueDate; - - return $this; - } - - /** - * Gets scheduledDate - * - * @return \DateTime - */ - public function getScheduledDate() - { - return $this->container['scheduledDate']; - } - - /** - * Sets scheduledDate - * - * @param \DateTime $scheduledDate The publication (scheduled) date of the assignment. If this one is specified, the assignment will only be listed to the teachers of the class. - * - * @return $this - */ - public function setScheduledDate($scheduledDate) - { - $this->container['scheduledDate'] = $scheduledDate; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/AssignmentSubmission.php b/lib/Model/AssignmentSubmission.php deleted file mode 100644 index 56707ed..0000000 --- a/lib/Model/AssignmentSubmission.php +++ /dev/null @@ -1,632 +0,0 @@ - 'string', - 'classroom' => 'string', - 'assignment' => 'string', - 'creator' => 'string', - 'creationDate' => 'string', - 'attachments' => '\Flat\APIClient\Model\MediaAttachment[]', - 'submissionDate' => 'string', - 'studentComment' => 'string', - 'returnDate' => 'string', - 'returnFeedback' => 'string', - 'returnCreator' => 'string', - 'googleClassroom' => '\Flat\APIClient\Model\GoogleClassroomSubmission' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null, - 'classroom' => null, - 'assignment' => null, - 'creator' => null, - 'creationDate' => null, - 'attachments' => null, - 'submissionDate' => null, - 'studentComment' => null, - 'returnDate' => null, - 'returnFeedback' => null, - 'returnCreator' => null, - 'googleClassroom' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'classroom' => 'classroom', - 'assignment' => 'assignment', - 'creator' => 'creator', - 'creationDate' => 'creationDate', - 'attachments' => 'attachments', - 'submissionDate' => 'submissionDate', - 'studentComment' => 'studentComment', - 'returnDate' => 'returnDate', - 'returnFeedback' => 'returnFeedback', - 'returnCreator' => 'returnCreator', - 'googleClassroom' => 'googleClassroom' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'classroom' => 'setClassroom', - 'assignment' => 'setAssignment', - 'creator' => 'setCreator', - 'creationDate' => 'setCreationDate', - 'attachments' => 'setAttachments', - 'submissionDate' => 'setSubmissionDate', - 'studentComment' => 'setStudentComment', - 'returnDate' => 'setReturnDate', - 'returnFeedback' => 'setReturnFeedback', - 'returnCreator' => 'setReturnCreator', - 'googleClassroom' => 'setGoogleClassroom' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'classroom' => 'getClassroom', - 'assignment' => 'getAssignment', - 'creator' => 'getCreator', - 'creationDate' => 'getCreationDate', - 'attachments' => 'getAttachments', - 'submissionDate' => 'getSubmissionDate', - 'studentComment' => 'getStudentComment', - 'returnDate' => 'getReturnDate', - 'returnFeedback' => 'getReturnFeedback', - 'returnCreator' => 'getReturnCreator', - 'googleClassroom' => 'getGoogleClassroom' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['classroom'] = isset($data['classroom']) ? $data['classroom'] : null; - $this->container['assignment'] = isset($data['assignment']) ? $data['assignment'] : null; - $this->container['creator'] = isset($data['creator']) ? $data['creator'] : null; - $this->container['creationDate'] = isset($data['creationDate']) ? $data['creationDate'] : null; - $this->container['attachments'] = isset($data['attachments']) ? $data['attachments'] : null; - $this->container['submissionDate'] = isset($data['submissionDate']) ? $data['submissionDate'] : null; - $this->container['studentComment'] = isset($data['studentComment']) ? $data['studentComment'] : null; - $this->container['returnDate'] = isset($data['returnDate']) ? $data['returnDate'] : null; - $this->container['returnFeedback'] = isset($data['returnFeedback']) ? $data['returnFeedback'] : null; - $this->container['returnCreator'] = isset($data['returnCreator']) ? $data['returnCreator'] : null; - $this->container['googleClassroom'] = isset($data['googleClassroom']) ? $data['googleClassroom'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id Unique identifier of the submission - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets classroom - * - * @return string - */ - public function getClassroom() - { - return $this->container['classroom']; - } - - /** - * Sets classroom - * - * @param string $classroom Unique identifier of the classroom where the assignment was posted - * - * @return $this - */ - public function setClassroom($classroom) - { - $this->container['classroom'] = $classroom; - - return $this; - } - - /** - * Gets assignment - * - * @return string - */ - public function getAssignment() - { - return $this->container['assignment']; - } - - /** - * Sets assignment - * - * @param string $assignment Unique identifier of the assignment - * - * @return $this - */ - public function setAssignment($assignment) - { - $this->container['assignment'] = $assignment; - - return $this; - } - - /** - * Gets creator - * - * @return string - */ - public function getCreator() - { - return $this->container['creator']; - } - - /** - * Sets creator - * - * @param string $creator The User identifier of the student who created the submission - * - * @return $this - */ - public function setCreator($creator) - { - $this->container['creator'] = $creator; - - return $this; - } - - /** - * Gets creationDate - * - * @return string - */ - public function getCreationDate() - { - return $this->container['creationDate']; - } - - /** - * Sets creationDate - * - * @param string $creationDate The date when the submission was created - * - * @return $this - */ - public function setCreationDate($creationDate) - { - $this->container['creationDate'] = $creationDate; - - return $this; - } - - /** - * Gets attachments - * - * @return \Flat\APIClient\Model\MediaAttachment[] - */ - public function getAttachments() - { - return $this->container['attachments']; - } - - /** - * Sets attachments - * - * @param \Flat\APIClient\Model\MediaAttachment[] $attachments attachments - * - * @return $this - */ - public function setAttachments($attachments) - { - $this->container['attachments'] = $attachments; - - return $this; - } - - /** - * Gets submissionDate - * - * @return string - */ - public function getSubmissionDate() - { - return $this->container['submissionDate']; - } - - /** - * Sets submissionDate - * - * @param string $submissionDate The date when the student submitted his work - * - * @return $this - */ - public function setSubmissionDate($submissionDate) - { - $this->container['submissionDate'] = $submissionDate; - - return $this; - } - - /** - * Gets studentComment - * - * @return string - */ - public function getStudentComment() - { - return $this->container['studentComment']; - } - - /** - * Sets studentComment - * - * @param string $studentComment An optionnal comment sent by the student when submitting his work - * - * @return $this - */ - public function setStudentComment($studentComment) - { - $this->container['studentComment'] = $studentComment; - - return $this; - } - - /** - * Gets returnDate - * - * @return string - */ - public function getReturnDate() - { - return $this->container['returnDate']; - } - - /** - * Sets returnDate - * - * @param string $returnDate The date when the teacher returned the work - * - * @return $this - */ - public function setReturnDate($returnDate) - { - $this->container['returnDate'] = $returnDate; - - return $this; - } - - /** - * Gets returnFeedback - * - * @return string - */ - public function getReturnFeedback() - { - return $this->container['returnFeedback']; - } - - /** - * Sets returnFeedback - * - * @param string $returnFeedback The feedback associated with the return - * - * @return $this - */ - public function setReturnFeedback($returnFeedback) - { - $this->container['returnFeedback'] = $returnFeedback; - - return $this; - } - - /** - * Gets returnCreator - * - * @return string - */ - public function getReturnCreator() - { - return $this->container['returnCreator']; - } - - /** - * Sets returnCreator - * - * @param string $returnCreator The User unique identifier of the teacher who returned the submission - * - * @return $this - */ - public function setReturnCreator($returnCreator) - { - $this->container['returnCreator'] = $returnCreator; - - return $this; - } - - /** - * Gets googleClassroom - * - * @return \Flat\APIClient\Model\GoogleClassroomSubmission - */ - public function getGoogleClassroom() - { - return $this->container['googleClassroom']; - } - - /** - * Sets googleClassroom - * - * @param \Flat\APIClient\Model\GoogleClassroomSubmission $googleClassroom googleClassroom - * - * @return $this - */ - public function setGoogleClassroom($googleClassroom) - { - $this->container['googleClassroom'] = $googleClassroom; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/AssignmentSubmissionUpdate.php b/lib/Model/AssignmentSubmissionUpdate.php deleted file mode 100644 index adaa635..0000000 --- a/lib/Model/AssignmentSubmissionUpdate.php +++ /dev/null @@ -1,392 +0,0 @@ - '\Flat\APIClient\Model\ClassAttachmentCreation[]', - 'studentComment' => 'string', - 'submit' => 'bool', - 'returnFeedback' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'attachments' => null, - 'studentComment' => null, - 'submit' => null, - 'returnFeedback' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'attachments' => 'attachments', - 'studentComment' => 'studentComment', - 'submit' => 'submit', - 'returnFeedback' => 'returnFeedback' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'attachments' => 'setAttachments', - 'studentComment' => 'setStudentComment', - 'submit' => 'setSubmit', - 'returnFeedback' => 'setReturnFeedback' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'attachments' => 'getAttachments', - 'studentComment' => 'getStudentComment', - 'submit' => 'getSubmit', - 'returnFeedback' => 'getReturnFeedback' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['attachments'] = isset($data['attachments']) ? $data['attachments'] : null; - $this->container['studentComment'] = isset($data['studentComment']) ? $data['studentComment'] : null; - $this->container['submit'] = isset($data['submit']) ? $data['submit'] : null; - $this->container['returnFeedback'] = isset($data['returnFeedback']) ? $data['returnFeedback'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets attachments - * - * @return \Flat\APIClient\Model\ClassAttachmentCreation[] - */ - public function getAttachments() - { - return $this->container['attachments']; - } - - /** - * Sets attachments - * - * @param \Flat\APIClient\Model\ClassAttachmentCreation[] $attachments attachments - * - * @return $this - */ - public function setAttachments($attachments) - { - $this->container['attachments'] = $attachments; - - return $this; - } - - /** - * Gets studentComment - * - * @return string - */ - public function getStudentComment() - { - return $this->container['studentComment']; - } - - /** - * Sets studentComment - * - * @param string $studentComment An optionnal comment sent by the student when submitting his work - * - * @return $this - */ - public function setStudentComment($studentComment) - { - $this->container['studentComment'] = $studentComment; - - return $this; - } - - /** - * Gets submit - * - * @return bool - */ - public function getSubmit() - { - return $this->container['submit']; - } - - /** - * Sets submit - * - * @param bool $submit If `true`, the submission will be marked as done - * - * @return $this - */ - public function setSubmit($submit) - { - $this->container['submit'] = $submit; - - return $this; - } - - /** - * Gets returnFeedback - * - * @return string - */ - public function getReturnFeedback() - { - return $this->container['returnFeedback']; - } - - /** - * Sets returnFeedback - * - * @param string $returnFeedback The feedback associated with the return - * - * @return $this - */ - public function setReturnFeedback($returnFeedback) - { - $this->container['returnFeedback'] = $returnFeedback; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ClassAttachmentCreation.php b/lib/Model/ClassAttachmentCreation.php deleted file mode 100644 index f255e13..0000000 --- a/lib/Model/ClassAttachmentCreation.php +++ /dev/null @@ -1,396 +0,0 @@ - 'string', - 'score' => 'string', - 'url' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'type' => null, - 'score' => null, - 'url' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'type' => 'type', - 'score' => 'score', - 'url' => 'url' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'type' => 'setType', - 'score' => 'setScore', - 'url' => 'setUrl' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'type' => 'getType', - 'score' => 'getScore', - 'url' => 'getUrl' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const TYPE_FLAT = 'flat'; - const TYPE_LINK = 'link'; - const TYPE_EXERCISE = 'exercise'; - - - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getTypeAllowableValues() - { - return [ - self::TYPE_FLAT, - self::TYPE_LINK, - self::TYPE_EXERCISE, - ]; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['score'] = isset($data['score']) ? $data['score'] : null; - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value for 'type', must be one of '%s'", - implode("', '", $allowedValues) - ); - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets type - * - * @return string - */ - public function getType() - { - return $this->container['type']; - } - - /** - * Sets type - * - * @param string $type The type of the attachment posted - * - * @return $this - */ - public function setType($type) - { - $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($type) && !in_array($type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'type', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); - } - $this->container['type'] = $type; - - return $this; - } - - /** - * Gets score - * - * @return string - */ - public function getScore() - { - return $this->container['score']; - } - - /** - * Sets score - * - * @param string $score A unique Flat score identifier. The user creating the assignment must at least have read access to the document. If the user has admin rights, new group permissions will be automatically added for the teachers and students of the class. - * - * @return $this - */ - public function setScore($score) - { - $this->container['score'] = $score; - - return $this; - } - - /** - * Gets url - * - * @return string - */ - public function getUrl() - { - return $this->container['url']; - } - - /** - * Sets url - * - * @param string $url The URL of the attachment. - * - * @return $this - */ - public function setUrl($url) - { - $this->container['url'] = $url; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ClassCreation.php b/lib/Model/ClassCreation.php deleted file mode 100644 index 4ea5617..0000000 --- a/lib/Model/ClassCreation.php +++ /dev/null @@ -1,351 +0,0 @@ - 'string', - 'section' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'name' => null, - 'section' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'name' => 'name', - 'section' => 'section' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'name' => 'setName', - 'section' => 'setSection' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'name' => 'getName', - 'section' => 'getSection' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['section'] = isset($data['section']) ? $data['section'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ((mb_strlen($this->container['name']) > 255)) { - $invalidProperties[] = "invalid value for 'name', the character length must be smaller than or equal to 255."; - } - - if (!is_null($this->container['section']) && (mb_strlen($this->container['section']) > 255)) { - $invalidProperties[] = "invalid value for 'section', the character length must be smaller than or equal to 255."; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name The name of the new class - * - * @return $this - */ - public function setName($name) - { - if ((mb_strlen($name) > 255)) { - throw new \InvalidArgumentException('invalid length for $name when calling ClassCreation., must be smaller than or equal to 255.'); - } - - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets section - * - * @return string - */ - public function getSection() - { - return $this->container['section']; - } - - /** - * Sets section - * - * @param string $section The section of the new class - * - * @return $this - */ - public function setSection($section) - { - if (!is_null($section) && (mb_strlen($section) > 255)) { - throw new \InvalidArgumentException('invalid length for $section when calling ClassCreation., must be smaller than or equal to 255.'); - } - - $this->container['section'] = $section; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ClassDetails.php b/lib/Model/ClassDetails.php deleted file mode 100644 index 458a1f3..0000000 --- a/lib/Model/ClassDetails.php +++ /dev/null @@ -1,812 +0,0 @@ - 'string', - 'state' => '\Flat\APIClient\Model\ClassState', - 'name' => 'string', - 'section' => 'string', - 'description' => 'string', - 'organization' => 'string', - 'owner' => 'string', - 'creationDate' => '\DateTime', - 'enrollmentCode' => 'string', - 'theme' => 'string', - 'assignmentsCount' => 'float', - 'studentsGroup' => '\Flat\APIClient\Model\GroupDetails', - 'teachersGroup' => '\Flat\APIClient\Model\GroupDetails', - 'googleClassroom' => '\Flat\APIClient\Model\ClassDetailsGoogleClassroom', - 'googleDrive' => '\Flat\APIClient\Model\ClassDetailsGoogleDrive', - 'lti' => '\Flat\APIClient\Model\ClassDetailsLti', - 'canvas' => '\Flat\APIClient\Model\ClassDetailsCanvas', - 'clever' => '\Flat\APIClient\Model\ClassDetailsClever' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null, - 'state' => null, - 'name' => null, - 'section' => null, - 'description' => null, - 'organization' => null, - 'owner' => null, - 'creationDate' => 'date-time', - 'enrollmentCode' => null, - 'theme' => null, - 'assignmentsCount' => null, - 'studentsGroup' => null, - 'teachersGroup' => null, - 'googleClassroom' => null, - 'googleDrive' => null, - 'lti' => null, - 'canvas' => null, - 'clever' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'state' => 'state', - 'name' => 'name', - 'section' => 'section', - 'description' => 'description', - 'organization' => 'organization', - 'owner' => 'owner', - 'creationDate' => 'creationDate', - 'enrollmentCode' => 'enrollmentCode', - 'theme' => 'theme', - 'assignmentsCount' => 'assignmentsCount', - 'studentsGroup' => 'studentsGroup', - 'teachersGroup' => 'teachersGroup', - 'googleClassroom' => 'googleClassroom', - 'googleDrive' => 'googleDrive', - 'lti' => 'lti', - 'canvas' => 'canvas', - 'clever' => 'clever' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'state' => 'setState', - 'name' => 'setName', - 'section' => 'setSection', - 'description' => 'setDescription', - 'organization' => 'setOrganization', - 'owner' => 'setOwner', - 'creationDate' => 'setCreationDate', - 'enrollmentCode' => 'setEnrollmentCode', - 'theme' => 'setTheme', - 'assignmentsCount' => 'setAssignmentsCount', - 'studentsGroup' => 'setStudentsGroup', - 'teachersGroup' => 'setTeachersGroup', - 'googleClassroom' => 'setGoogleClassroom', - 'googleDrive' => 'setGoogleDrive', - 'lti' => 'setLti', - 'canvas' => 'setCanvas', - 'clever' => 'setClever' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'state' => 'getState', - 'name' => 'getName', - 'section' => 'getSection', - 'description' => 'getDescription', - 'organization' => 'getOrganization', - 'owner' => 'getOwner', - 'creationDate' => 'getCreationDate', - 'enrollmentCode' => 'getEnrollmentCode', - 'theme' => 'getTheme', - 'assignmentsCount' => 'getAssignmentsCount', - 'studentsGroup' => 'getStudentsGroup', - 'teachersGroup' => 'getTeachersGroup', - 'googleClassroom' => 'getGoogleClassroom', - 'googleDrive' => 'getGoogleDrive', - 'lti' => 'getLti', - 'canvas' => 'getCanvas', - 'clever' => 'getClever' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['state'] = isset($data['state']) ? $data['state'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['section'] = isset($data['section']) ? $data['section'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; - $this->container['organization'] = isset($data['organization']) ? $data['organization'] : null; - $this->container['owner'] = isset($data['owner']) ? $data['owner'] : null; - $this->container['creationDate'] = isset($data['creationDate']) ? $data['creationDate'] : null; - $this->container['enrollmentCode'] = isset($data['enrollmentCode']) ? $data['enrollmentCode'] : null; - $this->container['theme'] = isset($data['theme']) ? $data['theme'] : null; - $this->container['assignmentsCount'] = isset($data['assignmentsCount']) ? $data['assignmentsCount'] : null; - $this->container['studentsGroup'] = isset($data['studentsGroup']) ? $data['studentsGroup'] : null; - $this->container['teachersGroup'] = isset($data['teachersGroup']) ? $data['teachersGroup'] : null; - $this->container['googleClassroom'] = isset($data['googleClassroom']) ? $data['googleClassroom'] : null; - $this->container['googleDrive'] = isset($data['googleDrive']) ? $data['googleDrive'] : null; - $this->container['lti'] = isset($data['lti']) ? $data['lti'] : null; - $this->container['canvas'] = isset($data['canvas']) ? $data['canvas'] : null; - $this->container['clever'] = isset($data['clever']) ? $data['clever'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id The unique identifier of the class - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets state - * - * @return \Flat\APIClient\Model\ClassState - */ - public function getState() - { - return $this->container['state']; - } - - /** - * Sets state - * - * @param \Flat\APIClient\Model\ClassState $state state - * - * @return $this - */ - public function setState($state) - { - $this->container['state'] = $state; - - return $this; - } - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name The name of the class - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets section - * - * @return string - */ - public function getSection() - { - return $this->container['section']; - } - - /** - * Sets section - * - * @param string $section The section of the class - * - * @return $this - */ - public function setSection($section) - { - $this->container['section'] = $section; - - return $this; - } - - /** - * Gets description - * - * @return string - */ - public function getDescription() - { - return $this->container['description']; - } - - /** - * Sets description - * - * @param string $description An optionnal description for this class - * - * @return $this - */ - public function setDescription($description) - { - $this->container['description'] = $description; - - return $this; - } - - /** - * Gets organization - * - * @return string - */ - public function getOrganization() - { - return $this->container['organization']; - } - - /** - * Sets organization - * - * @param string $organization The unique identifier of the Organization owning this class - * - * @return $this - */ - public function setOrganization($organization) - { - $this->container['organization'] = $organization; - - return $this; - } - - /** - * Gets owner - * - * @return string - */ - public function getOwner() - { - return $this->container['owner']; - } - - /** - * Sets owner - * - * @param string $owner The unique identifier of the User owning this class - * - * @return $this - */ - public function setOwner($owner) - { - $this->container['owner'] = $owner; - - return $this; - } - - /** - * Gets creationDate - * - * @return \DateTime - */ - public function getCreationDate() - { - return $this->container['creationDate']; - } - - /** - * Sets creationDate - * - * @param \DateTime $creationDate The date when the class was create - * - * @return $this - */ - public function setCreationDate($creationDate) - { - $this->container['creationDate'] = $creationDate; - - return $this; - } - - /** - * Gets enrollmentCode - * - * @return string - */ - public function getEnrollmentCode() - { - return $this->container['enrollmentCode']; - } - - /** - * Sets enrollmentCode - * - * @param string $enrollmentCode [Teachers only] The enrollment code that can be used by the students to join the class - * - * @return $this - */ - public function setEnrollmentCode($enrollmentCode) - { - $this->container['enrollmentCode'] = $enrollmentCode; - - return $this; - } - - /** - * Gets theme - * - * @return string - */ - public function getTheme() - { - return $this->container['theme']; - } - - /** - * Sets theme - * - * @param string $theme The theme identifier using in Flat User Interface - * - * @return $this - */ - public function setTheme($theme) - { - $this->container['theme'] = $theme; - - return $this; - } - - /** - * Gets assignmentsCount - * - * @return float - */ - public function getAssignmentsCount() - { - return $this->container['assignmentsCount']; - } - - /** - * Sets assignmentsCount - * - * @param float $assignmentsCount The number of assignments created in the class - * - * @return $this - */ - public function setAssignmentsCount($assignmentsCount) - { - $this->container['assignmentsCount'] = $assignmentsCount; - - return $this; - } - - /** - * Gets studentsGroup - * - * @return \Flat\APIClient\Model\GroupDetails - */ - public function getStudentsGroup() - { - return $this->container['studentsGroup']; - } - - /** - * Sets studentsGroup - * - * @param \Flat\APIClient\Model\GroupDetails $studentsGroup studentsGroup - * - * @return $this - */ - public function setStudentsGroup($studentsGroup) - { - $this->container['studentsGroup'] = $studentsGroup; - - return $this; - } - - /** - * Gets teachersGroup - * - * @return \Flat\APIClient\Model\GroupDetails - */ - public function getTeachersGroup() - { - return $this->container['teachersGroup']; - } - - /** - * Sets teachersGroup - * - * @param \Flat\APIClient\Model\GroupDetails $teachersGroup teachersGroup - * - * @return $this - */ - public function setTeachersGroup($teachersGroup) - { - $this->container['teachersGroup'] = $teachersGroup; - - return $this; - } - - /** - * Gets googleClassroom - * - * @return \Flat\APIClient\Model\ClassDetailsGoogleClassroom - */ - public function getGoogleClassroom() - { - return $this->container['googleClassroom']; - } - - /** - * Sets googleClassroom - * - * @param \Flat\APIClient\Model\ClassDetailsGoogleClassroom $googleClassroom googleClassroom - * - * @return $this - */ - public function setGoogleClassroom($googleClassroom) - { - $this->container['googleClassroom'] = $googleClassroom; - - return $this; - } - - /** - * Gets googleDrive - * - * @return \Flat\APIClient\Model\ClassDetailsGoogleDrive - */ - public function getGoogleDrive() - { - return $this->container['googleDrive']; - } - - /** - * Sets googleDrive - * - * @param \Flat\APIClient\Model\ClassDetailsGoogleDrive $googleDrive googleDrive - * - * @return $this - */ - public function setGoogleDrive($googleDrive) - { - $this->container['googleDrive'] = $googleDrive; - - return $this; - } - - /** - * Gets lti - * - * @return \Flat\APIClient\Model\ClassDetailsLti - */ - public function getLti() - { - return $this->container['lti']; - } - - /** - * Sets lti - * - * @param \Flat\APIClient\Model\ClassDetailsLti $lti lti - * - * @return $this - */ - public function setLti($lti) - { - $this->container['lti'] = $lti; - - return $this; - } - - /** - * Gets canvas - * - * @return \Flat\APIClient\Model\ClassDetailsCanvas - */ - public function getCanvas() - { - return $this->container['canvas']; - } - - /** - * Sets canvas - * - * @param \Flat\APIClient\Model\ClassDetailsCanvas $canvas canvas - * - * @return $this - */ - public function setCanvas($canvas) - { - $this->container['canvas'] = $canvas; - - return $this; - } - - /** - * Gets clever - * - * @return \Flat\APIClient\Model\ClassDetailsClever - */ - public function getClever() - { - return $this->container['clever']; - } - - /** - * Sets clever - * - * @param \Flat\APIClient\Model\ClassDetailsClever $clever clever - * - * @return $this - */ - public function setClever($clever) - { - $this->container['clever'] = $clever; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ClassDetailsCanvas.php b/lib/Model/ClassDetailsCanvas.php deleted file mode 100644 index 67d0efb..0000000 --- a/lib/Model/ClassDetailsCanvas.php +++ /dev/null @@ -1,332 +0,0 @@ - 'string', - 'domain' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null, - 'domain' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'domain' => 'domain' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'domain' => 'setDomain' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'domain' => 'getDomain' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['domain'] = isset($data['domain']) ? $data['domain'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id Unique identifier of the course on Canvas - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets domain - * - * @return string - */ - public function getDomain() - { - return $this->container['domain']; - } - - /** - * Sets domain - * - * @param string $domain Canvas instance domain (e.g. \"canvas.instructure.com\") - * - * @return $this - */ - public function setDomain($domain) - { - $this->container['domain'] = $domain; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ClassDetailsClever.php b/lib/Model/ClassDetailsClever.php deleted file mode 100644 index 27fd2ef..0000000 --- a/lib/Model/ClassDetailsClever.php +++ /dev/null @@ -1,532 +0,0 @@ - 'string', - 'creationDate' => '\DateTime', - 'modificationDate' => '\DateTime', - 'subject' => 'string', - 'termName' => 'string', - 'termStartDate' => '\DateTime', - 'termEndDate' => '\DateTime' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null, - 'creationDate' => 'date-time', - 'modificationDate' => 'date-time', - 'subject' => null, - 'termName' => null, - 'termStartDate' => 'date-time', - 'termEndDate' => 'date-time' - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'creationDate' => 'creationDate', - 'modificationDate' => 'modificationDate', - 'subject' => 'subject', - 'termName' => 'termName', - 'termStartDate' => 'termStartDate', - 'termEndDate' => 'termEndDate' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'creationDate' => 'setCreationDate', - 'modificationDate' => 'setModificationDate', - 'subject' => 'setSubject', - 'termName' => 'setTermName', - 'termStartDate' => 'setTermStartDate', - 'termEndDate' => 'setTermEndDate' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'creationDate' => 'getCreationDate', - 'modificationDate' => 'getModificationDate', - 'subject' => 'getSubject', - 'termName' => 'getTermName', - 'termStartDate' => 'getTermStartDate', - 'termEndDate' => 'getTermEndDate' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const SUBJECT_ENGLISHLANGUAGE_ARTS = 'english/language arts'; - const SUBJECT_MATH = 'math'; - const SUBJECT_SCIENCE = 'science'; - const SUBJECT_SOCIAL_STUDIES = 'social studies'; - const SUBJECT_LANGUAGE = 'language'; - const SUBJECT_HOMEROOMADVISORY = 'homeroom/advisory'; - const SUBJECT_INTERVENTIONSONLINE_LEARNING = 'interventions/online learning'; - const SUBJECT_TECHNOLOGY_AND_ENGINEERING = 'technology and engineering'; - const SUBJECT_PE_AND_HEALTH = 'PE and health'; - const SUBJECT_ARTS_AND_MUSIC = 'arts and music'; - const SUBJECT_OTHER = 'other'; - - - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getSubjectAllowableValues() - { - return [ - self::SUBJECT_ENGLISHLANGUAGE_ARTS, - self::SUBJECT_MATH, - self::SUBJECT_SCIENCE, - self::SUBJECT_SOCIAL_STUDIES, - self::SUBJECT_LANGUAGE, - self::SUBJECT_HOMEROOMADVISORY, - self::SUBJECT_INTERVENTIONSONLINE_LEARNING, - self::SUBJECT_TECHNOLOGY_AND_ENGINEERING, - self::SUBJECT_PE_AND_HEALTH, - self::SUBJECT_ARTS_AND_MUSIC, - self::SUBJECT_OTHER, - ]; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['creationDate'] = isset($data['creationDate']) ? $data['creationDate'] : null; - $this->container['modificationDate'] = isset($data['modificationDate']) ? $data['modificationDate'] : null; - $this->container['subject'] = isset($data['subject']) ? $data['subject'] : null; - $this->container['termName'] = isset($data['termName']) ? $data['termName'] : null; - $this->container['termStartDate'] = isset($data['termStartDate']) ? $data['termStartDate'] : null; - $this->container['termEndDate'] = isset($data['termEndDate']) ? $data['termEndDate'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - $allowedValues = $this->getSubjectAllowableValues(); - if (!is_null($this->container['subject']) && !in_array($this->container['subject'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value for 'subject', must be one of '%s'", - implode("', '", $allowedValues) - ); - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id Clever section unique identifier - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets creationDate - * - * @return \DateTime - */ - public function getCreationDate() - { - return $this->container['creationDate']; - } - - /** - * Sets creationDate - * - * @param \DateTime $creationDate The creation date of the section on clever - * - * @return $this - */ - public function setCreationDate($creationDate) - { - $this->container['creationDate'] = $creationDate; - - return $this; - } - - /** - * Gets modificationDate - * - * @return \DateTime - */ - public function getModificationDate() - { - return $this->container['modificationDate']; - } - - /** - * Sets modificationDate - * - * @param \DateTime $modificationDate The last modification date of the section on clever - * - * @return $this - */ - public function setModificationDate($modificationDate) - { - $this->container['modificationDate'] = $modificationDate; - - return $this; - } - - /** - * Gets subject - * - * @return string - */ - public function getSubject() - { - return $this->container['subject']; - } - - /** - * Sets subject - * - * @param string $subject Normalized subject of the course - * - * @return $this - */ - public function setSubject($subject) - { - $allowedValues = $this->getSubjectAllowableValues(); - if (!is_null($subject) && !in_array($subject, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'subject', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); - } - $this->container['subject'] = $subject; - - return $this; - } - - /** - * Gets termName - * - * @return string - */ - public function getTermName() - { - return $this->container['termName']; - } - - /** - * Sets termName - * - * @param string $termName Name of the term when this course happens - * - * @return $this - */ - public function setTermName($termName) - { - $this->container['termName'] = $termName; - - return $this; - } - - /** - * Gets termStartDate - * - * @return \DateTime - */ - public function getTermStartDate() - { - return $this->container['termStartDate']; - } - - /** - * Sets termStartDate - * - * @param \DateTime $termStartDate Beginning date of the term - * - * @return $this - */ - public function setTermStartDate($termStartDate) - { - $this->container['termStartDate'] = $termStartDate; - - return $this; - } - - /** - * Gets termEndDate - * - * @return \DateTime - */ - public function getTermEndDate() - { - return $this->container['termEndDate']; - } - - /** - * Sets termEndDate - * - * @param \DateTime $termEndDate End date of the term - * - * @return $this - */ - public function setTermEndDate($termEndDate) - { - $this->container['termEndDate'] = $termEndDate; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ClassDetailsGoogleClassroom.php b/lib/Model/ClassDetailsGoogleClassroom.php deleted file mode 100644 index bece1d6..0000000 --- a/lib/Model/ClassDetailsGoogleClassroom.php +++ /dev/null @@ -1,392 +0,0 @@ - 'string', - 'alternateLink' => 'string', - 'name' => 'string', - 'section' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null, - 'alternateLink' => null, - 'name' => null, - 'section' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'alternateLink' => 'alternateLink', - 'name' => 'name', - 'section' => 'section' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'alternateLink' => 'setAlternateLink', - 'name' => 'setName', - 'section' => 'setSection' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'alternateLink' => 'getAlternateLink', - 'name' => 'getName', - 'section' => 'getSection' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['alternateLink'] = isset($data['alternateLink']) ? $data['alternateLink'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['section'] = isset($data['section']) ? $data['section'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id The course identifier on Google Classroom - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets alternateLink - * - * @return string - */ - public function getAlternateLink() - { - return $this->container['alternateLink']; - } - - /** - * Sets alternateLink - * - * @param string $alternateLink Absolute link to this course in the Classroom web UI - * - * @return $this - */ - public function setAlternateLink($alternateLink) - { - $this->container['alternateLink'] = $alternateLink; - - return $this; - } - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name The name of the course on Google Classroom - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets section - * - * @return string - */ - public function getSection() - { - return $this->container['section']; - } - - /** - * Sets section - * - * @param string $section The section of the course on Google Classroom - * - * @return $this - */ - public function setSection($section) - { - $this->container['section'] = $section; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ClassDetailsGoogleDrive.php b/lib/Model/ClassDetailsGoogleDrive.php deleted file mode 100644 index 6dc190a..0000000 --- a/lib/Model/ClassDetailsGoogleDrive.php +++ /dev/null @@ -1,332 +0,0 @@ - 'string', - 'teacherFolderAlternateLink' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'teacherFolderId' => null, - 'teacherFolderAlternateLink' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'teacherFolderId' => 'teacherFolderId', - 'teacherFolderAlternateLink' => 'teacherFolderAlternateLink' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'teacherFolderId' => 'setTeacherFolderId', - 'teacherFolderAlternateLink' => 'setTeacherFolderAlternateLink' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'teacherFolderId' => 'getTeacherFolderId', - 'teacherFolderAlternateLink' => 'getTeacherFolderAlternateLink' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['teacherFolderId'] = isset($data['teacherFolderId']) ? $data['teacherFolderId'] : null; - $this->container['teacherFolderAlternateLink'] = isset($data['teacherFolderAlternateLink']) ? $data['teacherFolderAlternateLink'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets teacherFolderId - * - * @return string - */ - public function getTeacherFolderId() - { - return $this->container['teacherFolderId']; - } - - /** - * Sets teacherFolderId - * - * @param string $teacherFolderId [Teachers only] The Drive directory identifier of the teachers' folder - * - * @return $this - */ - public function setTeacherFolderId($teacherFolderId) - { - $this->container['teacherFolderId'] = $teacherFolderId; - - return $this; - } - - /** - * Gets teacherFolderAlternateLink - * - * @return string - */ - public function getTeacherFolderAlternateLink() - { - return $this->container['teacherFolderAlternateLink']; - } - - /** - * Sets teacherFolderAlternateLink - * - * @param string $teacherFolderAlternateLink [Teachers only] The Drive URL of the teachers' folder - * - * @return $this - */ - public function setTeacherFolderAlternateLink($teacherFolderAlternateLink) - { - $this->container['teacherFolderAlternateLink'] = $teacherFolderAlternateLink; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ClassDetailsLti.php b/lib/Model/ClassDetailsLti.php deleted file mode 100644 index 55f7511..0000000 --- a/lib/Model/ClassDetailsLti.php +++ /dev/null @@ -1,362 +0,0 @@ - 'string', - 'contextTitle' => 'string', - 'contextLabel' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'contextId' => null, - 'contextTitle' => null, - 'contextLabel' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'contextId' => 'contextId', - 'contextTitle' => 'contextTitle', - 'contextLabel' => 'contextLabel' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'contextId' => 'setContextId', - 'contextTitle' => 'setContextTitle', - 'contextLabel' => 'setContextLabel' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'contextId' => 'getContextId', - 'contextTitle' => 'getContextTitle', - 'contextLabel' => 'getContextLabel' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['contextId'] = isset($data['contextId']) ? $data['contextId'] : null; - $this->container['contextTitle'] = isset($data['contextTitle']) ? $data['contextTitle'] : null; - $this->container['contextLabel'] = isset($data['contextLabel']) ? $data['contextLabel'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets contextId - * - * @return string - */ - public function getContextId() - { - return $this->container['contextId']; - } - - /** - * Sets contextId - * - * @param string $contextId Unique context identifier provided - * - * @return $this - */ - public function setContextId($contextId) - { - $this->container['contextId'] = $contextId; - - return $this; - } - - /** - * Gets contextTitle - * - * @return string - */ - public function getContextTitle() - { - return $this->container['contextTitle']; - } - - /** - * Sets contextTitle - * - * @param string $contextTitle Context title - * - * @return $this - */ - public function setContextTitle($contextTitle) - { - $this->container['contextTitle'] = $contextTitle; - - return $this; - } - - /** - * Gets contextLabel - * - * @return string - */ - public function getContextLabel() - { - return $this->container['contextLabel']; - } - - /** - * Sets contextLabel - * - * @param string $contextLabel Context label - * - * @return $this - */ - public function setContextLabel($contextLabel) - { - $this->container['contextLabel'] = $contextLabel; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ClassRoles.php b/lib/Model/ClassRoles.php deleted file mode 100644 index 5622daa..0000000 --- a/lib/Model/ClassRoles.php +++ /dev/null @@ -1,63 +0,0 @@ - 'string', - 'section' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'name' => null, - 'section' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'name' => 'name', - 'section' => 'section' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'name' => 'setName', - 'section' => 'setSection' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'name' => 'getName', - 'section' => 'getSection' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['section'] = isset($data['section']) ? $data['section'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if (!is_null($this->container['name']) && (mb_strlen($this->container['name']) > 255)) { - $invalidProperties[] = "invalid value for 'name', the character length must be smaller than or equal to 255."; - } - - if (!is_null($this->container['section']) && (mb_strlen($this->container['section']) > 255)) { - $invalidProperties[] = "invalid value for 'section', the character length must be smaller than or equal to 255."; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name The name of the class - * - * @return $this - */ - public function setName($name) - { - if (!is_null($name) && (mb_strlen($name) > 255)) { - throw new \InvalidArgumentException('invalid length for $name when calling ClassUpdate., must be smaller than or equal to 255.'); - } - - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets section - * - * @return string - */ - public function getSection() - { - return $this->container['section']; - } - - /** - * Sets section - * - * @param string $section The section of the class - * - * @return $this - */ - public function setSection($section) - { - if (!is_null($section) && (mb_strlen($section) > 255)) { - throw new \InvalidArgumentException('invalid length for $section when calling ClassUpdate., must be smaller than or equal to 255.'); - } - - $this->container['section'] = $section; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/Collection.php b/lib/Model/Collection.php deleted file mode 100644 index 1208a3f..0000000 --- a/lib/Model/Collection.php +++ /dev/null @@ -1,602 +0,0 @@ - 'string', - 'title' => '\Flat\APIClient\Model\CollectionTitle', - 'htmlUrl' => 'string', - 'type' => '\Flat\APIClient\Model\CollectionType', - 'privacy' => '\Flat\APIClient\Model\CollectionPrivacy', - 'sharingKey' => 'string', - 'app' => 'string', - 'user' => '\Flat\APIClient\Model\UserPublicSummary', - 'rights' => '\Flat\APIClient\Model\ResourceRights', - 'collaborators' => '\Flat\APIClient\Model\ResourceCollaborator[]', - 'capabilities' => '\Flat\APIClient\Model\CollectionCapabilities' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null, - 'title' => null, - 'htmlUrl' => 'url', - 'type' => null, - 'privacy' => null, - 'sharingKey' => null, - 'app' => null, - 'user' => null, - 'rights' => null, - 'collaborators' => null, - 'capabilities' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'title' => 'title', - 'htmlUrl' => 'htmlUrl', - 'type' => 'type', - 'privacy' => 'privacy', - 'sharingKey' => 'sharingKey', - 'app' => 'app', - 'user' => 'user', - 'rights' => 'rights', - 'collaborators' => 'collaborators', - 'capabilities' => 'capabilities' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'title' => 'setTitle', - 'htmlUrl' => 'setHtmlUrl', - 'type' => 'setType', - 'privacy' => 'setPrivacy', - 'sharingKey' => 'setSharingKey', - 'app' => 'setApp', - 'user' => 'setUser', - 'rights' => 'setRights', - 'collaborators' => 'setCollaborators', - 'capabilities' => 'setCapabilities' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'title' => 'getTitle', - 'htmlUrl' => 'getHtmlUrl', - 'type' => 'getType', - 'privacy' => 'getPrivacy', - 'sharingKey' => 'getSharingKey', - 'app' => 'getApp', - 'user' => 'getUser', - 'rights' => 'getRights', - 'collaborators' => 'getCollaborators', - 'capabilities' => 'getCapabilities' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['title'] = isset($data['title']) ? $data['title'] : null; - $this->container['htmlUrl'] = isset($data['htmlUrl']) ? $data['htmlUrl'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['privacy'] = isset($data['privacy']) ? $data['privacy'] : null; - $this->container['sharingKey'] = isset($data['sharingKey']) ? $data['sharingKey'] : null; - $this->container['app'] = isset($data['app']) ? $data['app'] : null; - $this->container['user'] = isset($data['user']) ? $data['user'] : null; - $this->container['rights'] = isset($data['rights']) ? $data['rights'] : null; - $this->container['collaborators'] = isset($data['collaborators']) ? $data['collaborators'] : null; - $this->container['capabilities'] = isset($data['capabilities']) ? $data['capabilities'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id Unique identifier of the collection - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets title - * - * @return \Flat\APIClient\Model\CollectionTitle - */ - public function getTitle() - { - return $this->container['title']; - } - - /** - * Sets title - * - * @param \Flat\APIClient\Model\CollectionTitle $title title - * - * @return $this - */ - public function setTitle($title) - { - $this->container['title'] = $title; - - return $this; - } - - /** - * Gets htmlUrl - * - * @return string - */ - public function getHtmlUrl() - { - return $this->container['htmlUrl']; - } - - /** - * Sets htmlUrl - * - * @param string $htmlUrl The url where the collection can be viewed in a web browser - * - * @return $this - */ - public function setHtmlUrl($htmlUrl) - { - $this->container['htmlUrl'] = $htmlUrl; - - return $this; - } - - /** - * Gets type - * - * @return \Flat\APIClient\Model\CollectionType - */ - public function getType() - { - return $this->container['type']; - } - - /** - * Sets type - * - * @param \Flat\APIClient\Model\CollectionType $type type - * - * @return $this - */ - public function setType($type) - { - $this->container['type'] = $type; - - return $this; - } - - /** - * Gets privacy - * - * @return \Flat\APIClient\Model\CollectionPrivacy - */ - public function getPrivacy() - { - return $this->container['privacy']; - } - - /** - * Sets privacy - * - * @param \Flat\APIClient\Model\CollectionPrivacy $privacy privacy - * - * @return $this - */ - public function setPrivacy($privacy) - { - $this->container['privacy'] = $privacy; - - return $this; - } - - /** - * Gets sharingKey - * - * @return string - */ - public function getSharingKey() - { - return $this->container['sharingKey']; - } - - /** - * Sets sharingKey - * - * @param string $sharingKey The private sharing key of the collection (available when the `privacy` mode is set to `privateLink`) - * - * @return $this - */ - public function setSharingKey($sharingKey) - { - $this->container['sharingKey'] = $sharingKey; - - return $this; - } - - /** - * Gets app - * - * @return string - */ - public function getApp() - { - return $this->container['app']; - } - - /** - * Sets app - * - * @param string $app If this directory is dedicated to an app, the unique idenfier of this app - * - * @return $this - */ - public function setApp($app) - { - $this->container['app'] = $app; - - return $this; - } - - /** - * Gets user - * - * @return \Flat\APIClient\Model\UserPublicSummary - */ - public function getUser() - { - return $this->container['user']; - } - - /** - * Sets user - * - * @param \Flat\APIClient\Model\UserPublicSummary $user user - * - * @return $this - */ - public function setUser($user) - { - $this->container['user'] = $user; - - return $this; - } - - /** - * Gets rights - * - * @return \Flat\APIClient\Model\ResourceRights - */ - public function getRights() - { - return $this->container['rights']; - } - - /** - * Sets rights - * - * @param \Flat\APIClient\Model\ResourceRights $rights rights - * - * @return $this - */ - public function setRights($rights) - { - $this->container['rights'] = $rights; - - return $this; - } - - /** - * Gets collaborators - * - * @return \Flat\APIClient\Model\ResourceCollaborator[] - */ - public function getCollaborators() - { - return $this->container['collaborators']; - } - - /** - * Sets collaborators - * - * @param \Flat\APIClient\Model\ResourceCollaborator[] $collaborators The list of the collaborators of the collection - * - * @return $this - */ - public function setCollaborators($collaborators) - { - $this->container['collaborators'] = $collaborators; - - return $this; - } - - /** - * Gets capabilities - * - * @return \Flat\APIClient\Model\CollectionCapabilities - */ - public function getCapabilities() - { - return $this->container['capabilities']; - } - - /** - * Sets capabilities - * - * @param \Flat\APIClient\Model\CollectionCapabilities $capabilities capabilities - * - * @return $this - */ - public function setCapabilities($capabilities) - { - $this->container['capabilities'] = $capabilities; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/CollectionCapabilities.php b/lib/Model/CollectionCapabilities.php deleted file mode 100644 index ff5d09b..0000000 --- a/lib/Model/CollectionCapabilities.php +++ /dev/null @@ -1,422 +0,0 @@ - 'bool', - 'canShare' => 'bool', - 'canDelete' => 'bool', - 'canAddScores' => 'bool', - 'canDeleteScores' => 'bool' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'canEdit' => null, - 'canShare' => null, - 'canDelete' => null, - 'canAddScores' => null, - 'canDeleteScores' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'canEdit' => 'canEdit', - 'canShare' => 'canShare', - 'canDelete' => 'canDelete', - 'canAddScores' => 'canAddScores', - 'canDeleteScores' => 'canDeleteScores' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'canEdit' => 'setCanEdit', - 'canShare' => 'setCanShare', - 'canDelete' => 'setCanDelete', - 'canAddScores' => 'setCanAddScores', - 'canDeleteScores' => 'setCanDeleteScores' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'canEdit' => 'getCanEdit', - 'canShare' => 'getCanShare', - 'canDelete' => 'getCanDelete', - 'canAddScores' => 'getCanAddScores', - 'canDeleteScores' => 'getCanDeleteScores' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['canEdit'] = isset($data['canEdit']) ? $data['canEdit'] : null; - $this->container['canShare'] = isset($data['canShare']) ? $data['canShare'] : null; - $this->container['canDelete'] = isset($data['canDelete']) ? $data['canDelete'] : null; - $this->container['canAddScores'] = isset($data['canAddScores']) ? $data['canAddScores'] : null; - $this->container['canDeleteScores'] = isset($data['canDeleteScores']) ? $data['canDeleteScores'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets canEdit - * - * @return bool - */ - public function getCanEdit() - { - return $this->container['canEdit']; - } - - /** - * Sets canEdit - * - * @param bool $canEdit Whether the current user can modify the metadata for the collection - * - * @return $this - */ - public function setCanEdit($canEdit) - { - $this->container['canEdit'] = $canEdit; - - return $this; - } - - /** - * Gets canShare - * - * @return bool - */ - public function getCanShare() - { - return $this->container['canShare']; - } - - /** - * Sets canShare - * - * @param bool $canShare Whether the current user can modify the sharing settings for the collection - * - * @return $this - */ - public function setCanShare($canShare) - { - $this->container['canShare'] = $canShare; - - return $this; - } - - /** - * Gets canDelete - * - * @return bool - */ - public function getCanDelete() - { - return $this->container['canDelete']; - } - - /** - * Sets canDelete - * - * @param bool $canDelete Whether the current user can delete the collection - * - * @return $this - */ - public function setCanDelete($canDelete) - { - $this->container['canDelete'] = $canDelete; - - return $this; - } - - /** - * Gets canAddScores - * - * @return bool - */ - public function getCanAddScores() - { - return $this->container['canAddScores']; - } - - /** - * Sets canAddScores - * - * @param bool $canAddScores Whether the current user can add scores to the collection If this collection has the `type` `trash`, this property will be set to `false`. Use `DELETE /v2/scores/{score}` to trash a score. - * - * @return $this - */ - public function setCanAddScores($canAddScores) - { - $this->container['canAddScores'] = $canAddScores; - - return $this; - } - - /** - * Gets canDeleteScores - * - * @return bool - */ - public function getCanDeleteScores() - { - return $this->container['canDeleteScores']; - } - - /** - * Sets canDeleteScores - * - * @param bool $canDeleteScores Whether the current user can delete scores from the collection If this collection has the `type` `trash`, this property will be set to `false`. Use `POST /v2/scores/{score}/untrash` to restore a score. - * - * @return $this - */ - public function setCanDeleteScores($canDeleteScores) - { - $this->container['canDeleteScores'] = $canDeleteScores; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/CollectionCreation.php b/lib/Model/CollectionCreation.php deleted file mode 100644 index 287acbc..0000000 --- a/lib/Model/CollectionCreation.php +++ /dev/null @@ -1,304 +0,0 @@ - '\Flat\APIClient\Model\CollectionTitle' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'title' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'title' => 'title' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'title' => 'setTitle' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'title' => 'getTitle' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['title'] = isset($data['title']) ? $data['title'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['title'] === null) { - $invalidProperties[] = "'title' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets title - * - * @return \Flat\APIClient\Model\CollectionTitle - */ - public function getTitle() - { - return $this->container['title']; - } - - /** - * Sets title - * - * @param \Flat\APIClient\Model\CollectionTitle $title title - * - * @return $this - */ - public function setTitle($title) - { - $this->container['title'] = $title; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/CollectionModification.php b/lib/Model/CollectionModification.php deleted file mode 100644 index 3161f68..0000000 --- a/lib/Model/CollectionModification.php +++ /dev/null @@ -1,302 +0,0 @@ - '\Flat\APIClient\Model\CollectionTitle' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'title' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'title' => 'title' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'title' => 'setTitle' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'title' => 'getTitle' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['title'] = isset($data['title']) ? $data['title'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets title - * - * @return \Flat\APIClient\Model\CollectionTitle - */ - public function getTitle() - { - return $this->container['title']; - } - - /** - * Sets title - * - * @param \Flat\APIClient\Model\CollectionTitle $title title - * - * @return $this - */ - public function setTitle($title) - { - $this->container['title'] = $title; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/CollectionPrivacy.php b/lib/Model/CollectionPrivacy.php deleted file mode 100644 index b90d01a..0000000 --- a/lib/Model/CollectionPrivacy.php +++ /dev/null @@ -1,61 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/CollectionType.php b/lib/Model/CollectionType.php deleted file mode 100644 index 4389267..0000000 --- a/lib/Model/CollectionType.php +++ /dev/null @@ -1,69 +0,0 @@ - 'string', - 'message' => 'string', - 'id' => 'string', - 'param' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'code' => null, - 'message' => null, - 'id' => null, - 'param' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'code' => 'code', - 'message' => 'message', - 'id' => 'id', - 'param' => 'param' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'code' => 'setCode', - 'message' => 'setMessage', - 'id' => 'setId', - 'param' => 'setParam' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'code' => 'getCode', - 'message' => 'getMessage', - 'id' => 'getId', - 'param' => 'getParam' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['code'] = isset($data['code']) ? $data['code'] : null; - $this->container['message'] = isset($data['message']) ? $data['message'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['param'] = isset($data['param']) ? $data['param'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets code - * - * @return string - */ - public function getCode() - { - return $this->container['code']; - } - - /** - * Sets code - * - * @param string $code A corresponding code for this error - * - * @return $this - */ - public function setCode($code) - { - $this->container['code'] = $code; - - return $this; - } - - /** - * Gets message - * - * @return string - */ - public function getMessage() - { - return $this->container['message']; - } - - /** - * Sets message - * - * @param string $message A printable message for this message - * - * @return $this - */ - public function setMessage($message) - { - $this->container['message'] = $message; - - return $this; - } - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id An unique error identifier generated for the request - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets param - * - * @return string - */ - public function getParam() - { - return $this->container['param']; - } - - /** - * Sets param - * - * @param string $param The related parameter that caused the error - * - * @return $this - */ - public function setParam($param) - { - $this->container['param'] = $param; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/FlatLocales.php b/lib/Model/FlatLocales.php deleted file mode 100644 index 16edcd9..0000000 --- a/lib/Model/FlatLocales.php +++ /dev/null @@ -1,73 +0,0 @@ - 'string', - 'state' => 'string', - 'alternateLink' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null, - 'state' => null, - 'alternateLink' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'state' => 'state', - 'alternateLink' => 'alternateLink' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'state' => 'setState', - 'alternateLink' => 'setAlternateLink' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'state' => 'getState', - 'alternateLink' => 'getAlternateLink' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['state'] = isset($data['state']) ? $data['state'] : null; - $this->container['alternateLink'] = isset($data['alternateLink']) ? $data['alternateLink'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id Identifier of the coursework assigned by Classroom - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets state - * - * @return string - */ - public function getState() - { - return $this->container['state']; - } - - /** - * Sets state - * - * @param string $state State of the coursework - * - * @return $this - */ - public function setState($state) - { - $this->container['state'] = $state; - - return $this; - } - - /** - * Gets alternateLink - * - * @return string - */ - public function getAlternateLink() - { - return $this->container['alternateLink']; - } - - /** - * Sets alternateLink - * - * @param string $alternateLink Absolute link to this coursework in the Classroom web UI - * - * @return $this - */ - public function setAlternateLink($alternateLink) - { - $this->container['alternateLink'] = $alternateLink; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/GoogleClassroomSubmission.php b/lib/Model/GoogleClassroomSubmission.php deleted file mode 100644 index 5ecf2c5..0000000 --- a/lib/Model/GoogleClassroomSubmission.php +++ /dev/null @@ -1,362 +0,0 @@ - 'string', - 'state' => 'string', - 'alternateLink' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null, - 'state' => null, - 'alternateLink' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'state' => 'state', - 'alternateLink' => 'alternateLink' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'state' => 'setState', - 'alternateLink' => 'setAlternateLink' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'state' => 'getState', - 'alternateLink' => 'getAlternateLink' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['state'] = isset($data['state']) ? $data['state'] : null; - $this->container['alternateLink'] = isset($data['alternateLink']) ? $data['alternateLink'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id Identifier of the coursework submission assigned by Classroom - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets state - * - * @return string - */ - public function getState() - { - return $this->container['state']; - } - - /** - * Sets state - * - * @param string $state State of the submission on Google Classroom - * - * @return $this - */ - public function setState($state) - { - $this->container['state'] = $state; - - return $this; - } - - /** - * Gets alternateLink - * - * @return string - */ - public function getAlternateLink() - { - return $this->container['alternateLink']; - } - - /** - * Sets alternateLink - * - * @param string $alternateLink Absolute link to this coursework in the Classroom web UI - * - * @return $this - */ - public function setAlternateLink($alternateLink) - { - $this->container['alternateLink'] = $alternateLink; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/Group.php b/lib/Model/Group.php deleted file mode 100644 index 6c1708b..0000000 --- a/lib/Model/Group.php +++ /dev/null @@ -1,516 +0,0 @@ - 'string', - 'name' => 'string', - 'type' => 'string', - 'usersCount' => 'float', - 'readOnly' => 'bool', - 'organization' => 'string', - 'creationDate' => '\DateTime' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null, - 'name' => null, - 'type' => null, - 'usersCount' => null, - 'readOnly' => null, - 'organization' => null, - 'creationDate' => 'date-time' - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'name' => 'name', - 'type' => 'type', - 'usersCount' => 'usersCount', - 'readOnly' => 'readOnly', - 'organization' => 'organization', - 'creationDate' => 'creationDate' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'name' => 'setName', - 'type' => 'setType', - 'usersCount' => 'setUsersCount', - 'readOnly' => 'setReadOnly', - 'organization' => 'setOrganization', - 'creationDate' => 'setCreationDate' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'name' => 'getName', - 'type' => 'getType', - 'usersCount' => 'getUsersCount', - 'readOnly' => 'getReadOnly', - 'organization' => 'getOrganization', - 'creationDate' => 'getCreationDate' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const TYPE_GENERIC = 'generic'; - const TYPE_CLASS_TEACHERS = 'classTeachers'; - const TYPE_CLASS_STUDENTS = 'classStudents'; - - - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getTypeAllowableValues() - { - return [ - self::TYPE_GENERIC, - self::TYPE_CLASS_TEACHERS, - self::TYPE_CLASS_STUDENTS, - ]; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['usersCount'] = isset($data['usersCount']) ? $data['usersCount'] : null; - $this->container['readOnly'] = isset($data['readOnly']) ? $data['readOnly'] : null; - $this->container['organization'] = isset($data['organization']) ? $data['organization'] : null; - $this->container['creationDate'] = isset($data['creationDate']) ? $data['creationDate'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value for 'type', must be one of '%s'", - implode("', '", $allowedValues) - ); - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id The unique identifier of the group - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name The display name of the group - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets type - * - * @return string - */ - public function getType() - { - return $this->container['type']; - } - - /** - * Sets type - * - * @param string $type The type of the group: * `generic`: A group created by a Flat user * `classTeachers`: A group created automaticaly by Flat that contains the teachers of a class * `classStudents`: A group created automaticaly by Flat that contains the studnets of a class - * - * @return $this - */ - public function setType($type) - { - $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($type) && !in_array($type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'type', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); - } - $this->container['type'] = $type; - - return $this; - } - - /** - * Gets usersCount - * - * @return float - */ - public function getUsersCount() - { - return $this->container['usersCount']; - } - - /** - * Sets usersCount - * - * @param float $usersCount The number of users in this group - * - * @return $this - */ - public function setUsersCount($usersCount) - { - $this->container['usersCount'] = $usersCount; - - return $this; - } - - /** - * Gets readOnly - * - * @return bool - */ - public function getReadOnly() - { - return $this->container['readOnly']; - } - - /** - * Sets readOnly - * - * @param bool $readOnly `True` if the group is set in read-only - * - * @return $this - */ - public function setReadOnly($readOnly) - { - $this->container['readOnly'] = $readOnly; - - return $this; - } - - /** - * Gets organization - * - * @return string - */ - public function getOrganization() - { - return $this->container['organization']; - } - - /** - * Sets organization - * - * @param string $organization If the group is related to an organization, this field will contain the unique identifier of the organization - * - * @return $this - */ - public function setOrganization($organization) - { - $this->container['organization'] = $organization; - - return $this; - } - - /** - * Gets creationDate - * - * @return \DateTime - */ - public function getCreationDate() - { - return $this->container['creationDate']; - } - - /** - * Sets creationDate - * - * @param \DateTime $creationDate The creation date of the group - * - * @return $this - */ - public function setCreationDate($creationDate) - { - $this->container['creationDate'] = $creationDate; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/GroupDetails.php b/lib/Model/GroupDetails.php deleted file mode 100644 index 2cf72d7..0000000 --- a/lib/Model/GroupDetails.php +++ /dev/null @@ -1,482 +0,0 @@ - 'string', - 'name' => 'string', - 'type' => '\Flat\APIClient\Model\GroupType', - 'organization' => 'string', - 'creationDate' => '\DateTime', - 'usersCount' => 'float', - 'readOnly' => 'bool' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null, - 'name' => null, - 'type' => null, - 'organization' => null, - 'creationDate' => 'date-time', - 'usersCount' => null, - 'readOnly' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'name' => 'name', - 'type' => 'type', - 'organization' => 'organization', - 'creationDate' => 'creationDate', - 'usersCount' => 'usersCount', - 'readOnly' => 'readOnly' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'name' => 'setName', - 'type' => 'setType', - 'organization' => 'setOrganization', - 'creationDate' => 'setCreationDate', - 'usersCount' => 'setUsersCount', - 'readOnly' => 'setReadOnly' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'name' => 'getName', - 'type' => 'getType', - 'organization' => 'getOrganization', - 'creationDate' => 'getCreationDate', - 'usersCount' => 'getUsersCount', - 'readOnly' => 'getReadOnly' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['organization'] = isset($data['organization']) ? $data['organization'] : null; - $this->container['creationDate'] = isset($data['creationDate']) ? $data['creationDate'] : null; - $this->container['usersCount'] = isset($data['usersCount']) ? $data['usersCount'] : null; - $this->container['readOnly'] = isset($data['readOnly']) ? $data['readOnly'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id The unique identifier of the group - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name The displayable name of the group - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets type - * - * @return \Flat\APIClient\Model\GroupType - */ - public function getType() - { - return $this->container['type']; - } - - /** - * Sets type - * - * @param \Flat\APIClient\Model\GroupType $type type - * - * @return $this - */ - public function setType($type) - { - $this->container['type'] = $type; - - return $this; - } - - /** - * Gets organization - * - * @return string - */ - public function getOrganization() - { - return $this->container['organization']; - } - - /** - * Sets organization - * - * @param string $organization The unique identifier of the Organization owning the group - * - * @return $this - */ - public function setOrganization($organization) - { - $this->container['organization'] = $organization; - - return $this; - } - - /** - * Gets creationDate - * - * @return \DateTime - */ - public function getCreationDate() - { - return $this->container['creationDate']; - } - - /** - * Sets creationDate - * - * @param \DateTime $creationDate The date when the group was create - * - * @return $this - */ - public function setCreationDate($creationDate) - { - $this->container['creationDate'] = $creationDate; - - return $this; - } - - /** - * Gets usersCount - * - * @return float - */ - public function getUsersCount() - { - return $this->container['usersCount']; - } - - /** - * Sets usersCount - * - * @param float $usersCount The number of students in this group - * - * @return $this - */ - public function setUsersCount($usersCount) - { - $this->container['usersCount'] = $usersCount; - - return $this; - } - - /** - * Gets readOnly - * - * @return bool - */ - public function getReadOnly() - { - return $this->container['readOnly']; - } - - /** - * Sets readOnly - * - * @param bool $readOnly `true` if the properties and members of this group are in in read-only - * - * @return $this - */ - public function setReadOnly($readOnly) - { - $this->container['readOnly'] = $readOnly; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/GroupType.php b/lib/Model/GroupType.php deleted file mode 100644 index abb2aad..0000000 --- a/lib/Model/GroupType.php +++ /dev/null @@ -1,65 +0,0 @@ - 'string', - 'name' => 'string', - 'lms' => '\Flat\APIClient\Model\LmsName', - 'organization' => 'string', - 'creator' => 'string', - 'creationDate' => '\DateTime', - 'lastUsage' => '\DateTime', - 'consumerKey' => 'string', - 'consumerSecret' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null, - 'name' => null, - 'lms' => null, - 'organization' => null, - 'creator' => null, - 'creationDate' => 'date-time', - 'lastUsage' => 'date-time', - 'consumerKey' => null, - 'consumerSecret' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'name' => 'name', - 'lms' => 'lms', - 'organization' => 'organization', - 'creator' => 'creator', - 'creationDate' => 'creationDate', - 'lastUsage' => 'lastUsage', - 'consumerKey' => 'consumerKey', - 'consumerSecret' => 'consumerSecret' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'name' => 'setName', - 'lms' => 'setLms', - 'organization' => 'setOrganization', - 'creator' => 'setCreator', - 'creationDate' => 'setCreationDate', - 'lastUsage' => 'setLastUsage', - 'consumerKey' => 'setConsumerKey', - 'consumerSecret' => 'setConsumerSecret' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'name' => 'getName', - 'lms' => 'getLms', - 'organization' => 'getOrganization', - 'creator' => 'getCreator', - 'creationDate' => 'getCreationDate', - 'lastUsage' => 'getLastUsage', - 'consumerKey' => 'getConsumerKey', - 'consumerSecret' => 'getConsumerSecret' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['lms'] = isset($data['lms']) ? $data['lms'] : null; - $this->container['organization'] = isset($data['organization']) ? $data['organization'] : null; - $this->container['creator'] = isset($data['creator']) ? $data['creator'] : null; - $this->container['creationDate'] = isset($data['creationDate']) ? $data['creationDate'] : null; - $this->container['lastUsage'] = isset($data['lastUsage']) ? $data['lastUsage'] : null; - $this->container['consumerKey'] = isset($data['consumerKey']) ? $data['consumerKey'] : null; - $this->container['consumerSecret'] = isset($data['consumerSecret']) ? $data['consumerSecret'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id The unique identifier of this couple of credentials - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Name of the couple of credentials - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets lms - * - * @return \Flat\APIClient\Model\LmsName - */ - public function getLms() - { - return $this->container['lms']; - } - - /** - * Sets lms - * - * @param \Flat\APIClient\Model\LmsName $lms lms - * - * @return $this - */ - public function setLms($lms) - { - $this->container['lms'] = $lms; - - return $this; - } - - /** - * Gets organization - * - * @return string - */ - public function getOrganization() - { - return $this->container['organization']; - } - - /** - * Sets organization - * - * @param string $organization The unique identifier of the Organization associated to these credentials - * - * @return $this - */ - public function setOrganization($organization) - { - $this->container['organization'] = $organization; - - return $this; - } - - /** - * Gets creator - * - * @return string - */ - public function getCreator() - { - return $this->container['creator']; - } - - /** - * Sets creator - * - * @param string $creator Unique identifier of the user who created these credentials - * - * @return $this - */ - public function setCreator($creator) - { - $this->container['creator'] = $creator; - - return $this; - } - - /** - * Gets creationDate - * - * @return \DateTime - */ - public function getCreationDate() - { - return $this->container['creationDate']; - } - - /** - * Sets creationDate - * - * @param \DateTime $creationDate The creation date of thse credentials - * - * @return $this - */ - public function setCreationDate($creationDate) - { - $this->container['creationDate'] = $creationDate; - - return $this; - } - - /** - * Gets lastUsage - * - * @return \DateTime - */ - public function getLastUsage() - { - return $this->container['lastUsage']; - } - - /** - * Sets lastUsage - * - * @param \DateTime $lastUsage The last time these credentials were used - * - * @return $this - */ - public function setLastUsage($lastUsage) - { - $this->container['lastUsage'] = $lastUsage; - - return $this; - } - - /** - * Gets consumerKey - * - * @return string - */ - public function getConsumerKey() - { - return $this->container['consumerKey']; - } - - /** - * Sets consumerKey - * - * @param string $consumerKey OAuth 1 Consumer Key - * - * @return $this - */ - public function setConsumerKey($consumerKey) - { - $this->container['consumerKey'] = $consumerKey; - - return $this; - } - - /** - * Gets consumerSecret - * - * @return string - */ - public function getConsumerSecret() - { - return $this->container['consumerSecret']; - } - - /** - * Sets consumerSecret - * - * @param string $consumerSecret OAuth 1 Consumer Secret - * - * @return $this - */ - public function setConsumerSecret($consumerSecret) - { - $this->container['consumerSecret'] = $consumerSecret; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/LtiCredentialsCreation.php b/lib/Model/LtiCredentialsCreation.php deleted file mode 100644 index 63a2d3e..0000000 --- a/lib/Model/LtiCredentialsCreation.php +++ /dev/null @@ -1,346 +0,0 @@ - 'string', - 'lms' => '\Flat\APIClient\Model\LmsName' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'name' => null, - 'lms' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'name' => 'name', - 'lms' => 'lms' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'name' => 'setName', - 'lms' => 'setLms' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'name' => 'getName', - 'lms' => 'getLms' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['lms'] = isset($data['lms']) ? $data['lms'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ((mb_strlen($this->container['name']) > 300)) { - $invalidProperties[] = "invalid value for 'name', the character length must be smaller than or equal to 300."; - } - - if ($this->container['lms'] === null) { - $invalidProperties[] = "'lms' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Name of the couple of credentials - * - * @return $this - */ - public function setName($name) - { - if ((mb_strlen($name) > 300)) { - throw new \InvalidArgumentException('invalid length for $name when calling LtiCredentialsCreation., must be smaller than or equal to 300.'); - } - - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets lms - * - * @return \Flat\APIClient\Model\LmsName - */ - public function getLms() - { - return $this->container['lms']; - } - - /** - * Sets lms - * - * @param \Flat\APIClient\Model\LmsName $lms lms - * - * @return $this - */ - public function setLms($lms) - { - $this->container['lms'] = $lms; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/MediaAttachment.php b/lib/Model/MediaAttachment.php deleted file mode 100644 index 486a564..0000000 --- a/lib/Model/MediaAttachment.php +++ /dev/null @@ -1,792 +0,0 @@ - 'string', - 'score' => 'string', - 'revision' => 'string', - 'correct' => 'bool', - 'sharingMode' => '\Flat\APIClient\Model\MediaScoreSharingMode', - 'title' => 'string', - 'description' => 'string', - 'html' => 'string', - 'htmlWidth' => 'string', - 'htmlHeight' => 'string', - 'url' => 'string', - 'thumbnailUrl' => 'string', - 'thumbnailWidth' => 'string', - 'thumbnailHeight' => 'string', - 'authorName' => 'string', - 'authorUrl' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'type' => null, - 'score' => null, - 'revision' => null, - 'correct' => null, - 'sharingMode' => null, - 'title' => null, - 'description' => null, - 'html' => null, - 'htmlWidth' => null, - 'htmlHeight' => null, - 'url' => null, - 'thumbnailUrl' => null, - 'thumbnailWidth' => null, - 'thumbnailHeight' => null, - 'authorName' => null, - 'authorUrl' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'type' => 'type', - 'score' => 'score', - 'revision' => 'revision', - 'correct' => 'correct', - 'sharingMode' => 'sharingMode', - 'title' => 'title', - 'description' => 'description', - 'html' => 'html', - 'htmlWidth' => 'htmlWidth', - 'htmlHeight' => 'htmlHeight', - 'url' => 'url', - 'thumbnailUrl' => 'thumbnailUrl', - 'thumbnailWidth' => 'thumbnailWidth', - 'thumbnailHeight' => 'thumbnailHeight', - 'authorName' => 'authorName', - 'authorUrl' => 'authorUrl' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'type' => 'setType', - 'score' => 'setScore', - 'revision' => 'setRevision', - 'correct' => 'setCorrect', - 'sharingMode' => 'setSharingMode', - 'title' => 'setTitle', - 'description' => 'setDescription', - 'html' => 'setHtml', - 'htmlWidth' => 'setHtmlWidth', - 'htmlHeight' => 'setHtmlHeight', - 'url' => 'setUrl', - 'thumbnailUrl' => 'setThumbnailUrl', - 'thumbnailWidth' => 'setThumbnailWidth', - 'thumbnailHeight' => 'setThumbnailHeight', - 'authorName' => 'setAuthorName', - 'authorUrl' => 'setAuthorUrl' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'type' => 'getType', - 'score' => 'getScore', - 'revision' => 'getRevision', - 'correct' => 'getCorrect', - 'sharingMode' => 'getSharingMode', - 'title' => 'getTitle', - 'description' => 'getDescription', - 'html' => 'getHtml', - 'htmlWidth' => 'getHtmlWidth', - 'htmlHeight' => 'getHtmlHeight', - 'url' => 'getUrl', - 'thumbnailUrl' => 'getThumbnailUrl', - 'thumbnailWidth' => 'getThumbnailWidth', - 'thumbnailHeight' => 'getThumbnailHeight', - 'authorName' => 'getAuthorName', - 'authorUrl' => 'getAuthorUrl' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const TYPE_RICH = 'rich'; - const TYPE_PHOTO = 'photo'; - const TYPE_VIDEO = 'video'; - const TYPE_LINK = 'link'; - const TYPE_FLAT = 'flat'; - const TYPE_EXERCISE = 'exercise'; - - - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getTypeAllowableValues() - { - return [ - self::TYPE_RICH, - self::TYPE_PHOTO, - self::TYPE_VIDEO, - self::TYPE_LINK, - self::TYPE_FLAT, - self::TYPE_EXERCISE, - ]; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['score'] = isset($data['score']) ? $data['score'] : null; - $this->container['revision'] = isset($data['revision']) ? $data['revision'] : null; - $this->container['correct'] = isset($data['correct']) ? $data['correct'] : null; - $this->container['sharingMode'] = isset($data['sharingMode']) ? $data['sharingMode'] : null; - $this->container['title'] = isset($data['title']) ? $data['title'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; - $this->container['html'] = isset($data['html']) ? $data['html'] : null; - $this->container['htmlWidth'] = isset($data['htmlWidth']) ? $data['htmlWidth'] : null; - $this->container['htmlHeight'] = isset($data['htmlHeight']) ? $data['htmlHeight'] : null; - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - $this->container['thumbnailUrl'] = isset($data['thumbnailUrl']) ? $data['thumbnailUrl'] : null; - $this->container['thumbnailWidth'] = isset($data['thumbnailWidth']) ? $data['thumbnailWidth'] : null; - $this->container['thumbnailHeight'] = isset($data['thumbnailHeight']) ? $data['thumbnailHeight'] : null; - $this->container['authorName'] = isset($data['authorName']) ? $data['authorName'] : null; - $this->container['authorUrl'] = isset($data['authorUrl']) ? $data['authorUrl'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value for 'type', must be one of '%s'", - implode("', '", $allowedValues) - ); - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets type - * - * @return string - */ - public function getType() - { - return $this->container['type']; - } - - /** - * Sets type - * - * @param string $type The type of the assignment resolved: * `rich`, `photo`, `video` are attachment types that are automatically resolved from a `link` attachment. * A `flat` attachment is a score document where the unique identifier will be specified in the `score` property. Its sharing mode will be provided in the `sharingMode` property. - * - * @return $this - */ - public function setType($type) - { - $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($type) && !in_array($type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'type', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); - } - $this->container['type'] = $type; - - return $this; - } - - /** - * Gets score - * - * @return string - */ - public function getScore() - { - return $this->container['score']; - } - - /** - * Sets score - * - * @param string $score An unique Flat score identifier - * - * @return $this - */ - public function setScore($score) - { - $this->container['score'] = $score; - - return $this; - } - - /** - * Gets revision - * - * @return string - */ - public function getRevision() - { - return $this->container['revision']; - } - - /** - * Sets revision - * - * @param string $revision An unique revision identifier of a score - * - * @return $this - */ - public function setRevision($revision) - { - $this->container['revision'] = $revision; - - return $this; - } - - /** - * Gets correct - * - * @return bool - */ - public function getCorrect() - { - return $this->container['correct']; - } - - /** - * Sets correct - * - * @param bool $correct If the attachment is an exercise question, this state will describe if it is correct or not.For exercise assignments only. - * - * @return $this - */ - public function setCorrect($correct) - { - $this->container['correct'] = $correct; - - return $this; - } - - /** - * Gets sharingMode - * - * @return \Flat\APIClient\Model\MediaScoreSharingMode - */ - public function getSharingMode() - { - return $this->container['sharingMode']; - } - - /** - * Sets sharingMode - * - * @param \Flat\APIClient\Model\MediaScoreSharingMode $sharingMode sharingMode - * - * @return $this - */ - public function setSharingMode($sharingMode) - { - $this->container['sharingMode'] = $sharingMode; - - return $this; - } - - /** - * Gets title - * - * @return string - */ - public function getTitle() - { - return $this->container['title']; - } - - /** - * Sets title - * - * @param string $title The resolved title of the attachment - * - * @return $this - */ - public function setTitle($title) - { - $this->container['title'] = $title; - - return $this; - } - - /** - * Gets description - * - * @return string - */ - public function getDescription() - { - return $this->container['description']; - } - - /** - * Sets description - * - * @param string $description The resolved description of the attachment - * - * @return $this - */ - public function setDescription($description) - { - $this->container['description'] = $description; - - return $this; - } - - /** - * Gets html - * - * @return string - */ - public function getHtml() - { - return $this->container['html']; - } - - /** - * Sets html - * - * @param string $html If the attachment type is `rich` or `video`, the HTML code of the media to display - * - * @return $this - */ - public function setHtml($html) - { - $this->container['html'] = $html; - - return $this; - } - - /** - * Gets htmlWidth - * - * @return string - */ - public function getHtmlWidth() - { - return $this->container['htmlWidth']; - } - - /** - * Sets htmlWidth - * - * @param string $htmlWidth If the `html` is available, the width of the widget - * - * @return $this - */ - public function setHtmlWidth($htmlWidth) - { - $this->container['htmlWidth'] = $htmlWidth; - - return $this; - } - - /** - * Gets htmlHeight - * - * @return string - */ - public function getHtmlHeight() - { - return $this->container['htmlHeight']; - } - - /** - * Sets htmlHeight - * - * @param string $htmlHeight If the `html` is available, the height of the widget - * - * @return $this - */ - public function setHtmlHeight($htmlHeight) - { - $this->container['htmlHeight'] = $htmlHeight; - - return $this; - } - - /** - * Gets url - * - * @return string - */ - public function getUrl() - { - return $this->container['url']; - } - - /** - * Sets url - * - * @param string $url The url of the attachment - * - * @return $this - */ - public function setUrl($url) - { - $this->container['url'] = $url; - - return $this; - } - - /** - * Gets thumbnailUrl - * - * @return string - */ - public function getThumbnailUrl() - { - return $this->container['thumbnailUrl']; - } - - /** - * Sets thumbnailUrl - * - * @param string $thumbnailUrl If the attachment type is `rich`, `video`, `photo` or `link`, a displayable thumbnail for this attachment - * - * @return $this - */ - public function setThumbnailUrl($thumbnailUrl) - { - $this->container['thumbnailUrl'] = $thumbnailUrl; - - return $this; - } - - /** - * Gets thumbnailWidth - * - * @return string - */ - public function getThumbnailWidth() - { - return $this->container['thumbnailWidth']; - } - - /** - * Sets thumbnailWidth - * - * @param string $thumbnailWidth If the `thumbnailUrl` is available, the width of the thumbnail - * - * @return $this - */ - public function setThumbnailWidth($thumbnailWidth) - { - $this->container['thumbnailWidth'] = $thumbnailWidth; - - return $this; - } - - /** - * Gets thumbnailHeight - * - * @return string - */ - public function getThumbnailHeight() - { - return $this->container['thumbnailHeight']; - } - - /** - * Sets thumbnailHeight - * - * @param string $thumbnailHeight If the `thumbnailUrl` is available, the width of the thumbnail - * - * @return $this - */ - public function setThumbnailHeight($thumbnailHeight) - { - $this->container['thumbnailHeight'] = $thumbnailHeight; - - return $this; - } - - /** - * Gets authorName - * - * @return string - */ - public function getAuthorName() - { - return $this->container['authorName']; - } - - /** - * Sets authorName - * - * @param string $authorName The resolved author name of the attachment - * - * @return $this - */ - public function setAuthorName($authorName) - { - $this->container['authorName'] = $authorName; - - return $this; - } - - /** - * Gets authorUrl - * - * @return string - */ - public function getAuthorUrl() - { - return $this->container['authorUrl']; - } - - /** - * Sets authorUrl - * - * @param string $authorUrl The resolved author url of the attachment - * - * @return $this - */ - public function setAuthorUrl($authorUrl) - { - $this->container['authorUrl'] = $authorUrl; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/MediaScoreSharingMode.php b/lib/Model/MediaScoreSharingMode.php deleted file mode 100644 index 8bcf4d5..0000000 --- a/lib/Model/MediaScoreSharingMode.php +++ /dev/null @@ -1,65 +0,0 @@ - 'string', - 'organization' => 'string', - 'organizationRole' => '\Flat\APIClient\Model\OrganizationRoles', - 'customCode' => 'string', - 'email' => 'string', - 'invitedBy' => 'string', - 'usedBy' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null, - 'organization' => null, - 'organizationRole' => null, - 'customCode' => null, - 'email' => null, - 'invitedBy' => null, - 'usedBy' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'organization' => 'organization', - 'organizationRole' => 'organizationRole', - 'customCode' => 'customCode', - 'email' => 'email', - 'invitedBy' => 'invitedBy', - 'usedBy' => 'usedBy' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'organization' => 'setOrganization', - 'organizationRole' => 'setOrganizationRole', - 'customCode' => 'setCustomCode', - 'email' => 'setEmail', - 'invitedBy' => 'setInvitedBy', - 'usedBy' => 'setUsedBy' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'organization' => 'getOrganization', - 'organizationRole' => 'getOrganizationRole', - 'customCode' => 'getCustomCode', - 'email' => 'getEmail', - 'invitedBy' => 'getInvitedBy', - 'usedBy' => 'getUsedBy' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['organization'] = isset($data['organization']) ? $data['organization'] : null; - $this->container['organizationRole'] = isset($data['organizationRole']) ? $data['organizationRole'] : null; - $this->container['customCode'] = isset($data['customCode']) ? $data['customCode'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['invitedBy'] = isset($data['invitedBy']) ? $data['invitedBy'] : null; - $this->container['usedBy'] = isset($data['usedBy']) ? $data['usedBy'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id The invitation unique identifier - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets organization - * - * @return string - */ - public function getOrganization() - { - return $this->container['organization']; - } - - /** - * Sets organization - * - * @param string $organization The unique identifier of the Organization owning this class - * - * @return $this - */ - public function setOrganization($organization) - { - $this->container['organization'] = $organization; - - return $this; - } - - /** - * Gets organizationRole - * - * @return \Flat\APIClient\Model\OrganizationRoles - */ - public function getOrganizationRole() - { - return $this->container['organizationRole']; - } - - /** - * Sets organizationRole - * - * @param \Flat\APIClient\Model\OrganizationRoles $organizationRole organizationRole - * - * @return $this - */ - public function setOrganizationRole($organizationRole) - { - $this->container['organizationRole'] = $organizationRole; - - return $this; - } - - /** - * Gets customCode - * - * @return string - */ - public function getCustomCode() - { - return $this->container['customCode']; - } - - /** - * Sets customCode - * - * @param string $customCode Enrollment code to use when joining this organization - * - * @return $this - */ - public function setCustomCode($customCode) - { - $this->container['customCode'] = $customCode; - - return $this; - } - - /** - * Gets email - * - * @return string - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param string $email The email address this invitation was sent to - * - * @return $this - */ - public function setEmail($email) - { - $this->container['email'] = $email; - - return $this; - } - - /** - * Gets invitedBy - * - * @return string - */ - public function getInvitedBy() - { - return $this->container['invitedBy']; - } - - /** - * Sets invitedBy - * - * @param string $invitedBy The unique identifier of the User who created this invitation - * - * @return $this - */ - public function setInvitedBy($invitedBy) - { - $this->container['invitedBy'] = $invitedBy; - - return $this; - } - - /** - * Gets usedBy - * - * @return string - */ - public function getUsedBy() - { - return $this->container['usedBy']; - } - - /** - * Sets usedBy - * - * @param string $usedBy The unique identifier of the User who used this invitation - * - * @return $this - */ - public function setUsedBy($usedBy) - { - $this->container['usedBy'] = $usedBy; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/OrganizationInvitationCreation.php b/lib/Model/OrganizationInvitationCreation.php deleted file mode 100644 index 61f0fb2..0000000 --- a/lib/Model/OrganizationInvitationCreation.php +++ /dev/null @@ -1,332 +0,0 @@ - 'string', - 'organizationRole' => '\Flat\APIClient\Model\OrganizationRoles' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'email' => null, - 'organizationRole' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'email' => 'email', - 'organizationRole' => 'organizationRole' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'email' => 'setEmail', - 'organizationRole' => 'setOrganizationRole' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'email' => 'getEmail', - 'organizationRole' => 'getOrganizationRole' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['organizationRole'] = isset($data['organizationRole']) ? $data['organizationRole'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets email - * - * @return string - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param string $email The email address you want to send the invitation to - * - * @return $this - */ - public function setEmail($email) - { - $this->container['email'] = $email; - - return $this; - } - - /** - * Gets organizationRole - * - * @return \Flat\APIClient\Model\OrganizationRoles - */ - public function getOrganizationRole() - { - return $this->container['organizationRole']; - } - - /** - * Sets organizationRole - * - * @param \Flat\APIClient\Model\OrganizationRoles $organizationRole organizationRole - * - * @return $this - */ - public function setOrganizationRole($organizationRole) - { - $this->container['organizationRole'] = $organizationRole; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/OrganizationRoles.php b/lib/Model/OrganizationRoles.php deleted file mode 100644 index 251f19c..0000000 --- a/lib/Model/OrganizationRoles.php +++ /dev/null @@ -1,67 +0,0 @@ - 'bool', - 'aclWrite' => 'bool', - 'aclAdmin' => 'bool', - 'id' => 'string', - 'score' => 'string', - 'collection' => 'string', - 'user' => '\Flat\APIClient\Model\UserPublic', - 'group' => '\Flat\APIClient\Model\Group', - 'userEmail' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'aclRead' => null, - 'aclWrite' => null, - 'aclAdmin' => null, - 'id' => null, - 'score' => null, - 'collection' => null, - 'user' => null, - 'group' => null, - 'userEmail' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'aclRead' => 'aclRead', - 'aclWrite' => 'aclWrite', - 'aclAdmin' => 'aclAdmin', - 'id' => 'id', - 'score' => 'score', - 'collection' => 'collection', - 'user' => 'user', - 'group' => 'group', - 'userEmail' => 'userEmail' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'aclRead' => 'setAclRead', - 'aclWrite' => 'setAclWrite', - 'aclAdmin' => 'setAclAdmin', - 'id' => 'setId', - 'score' => 'setScore', - 'collection' => 'setCollection', - 'user' => 'setUser', - 'group' => 'setGroup', - 'userEmail' => 'setUserEmail' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'aclRead' => 'getAclRead', - 'aclWrite' => 'getAclWrite', - 'aclAdmin' => 'getAclAdmin', - 'id' => 'getId', - 'score' => 'getScore', - 'collection' => 'getCollection', - 'user' => 'getUser', - 'group' => 'getGroup', - 'userEmail' => 'getUserEmail' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['aclRead'] = isset($data['aclRead']) ? $data['aclRead'] : false; - $this->container['aclWrite'] = isset($data['aclWrite']) ? $data['aclWrite'] : false; - $this->container['aclAdmin'] = isset($data['aclAdmin']) ? $data['aclAdmin'] : false; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['score'] = isset($data['score']) ? $data['score'] : null; - $this->container['collection'] = isset($data['collection']) ? $data['collection'] : null; - $this->container['user'] = isset($data['user']) ? $data['user'] : null; - $this->container['group'] = isset($data['group']) ? $data['group'] : null; - $this->container['userEmail'] = isset($data['userEmail']) ? $data['userEmail'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets aclRead - * - * @return bool - */ - public function getAclRead() - { - return $this->container['aclRead']; - } - - /** - * Sets aclRead - * - * @param bool $aclRead `True` if the current user can read the current document - * - * @return $this - */ - public function setAclRead($aclRead) - { - $this->container['aclRead'] = $aclRead; - - return $this; - } - - /** - * Gets aclWrite - * - * @return bool - */ - public function getAclWrite() - { - return $this->container['aclWrite']; - } - - /** - * Sets aclWrite - * - * @param bool $aclWrite `True` if the current user can modify the current document. If this is a right of a Collection, the capabilities of the associated user can be lower than this permission, check out the `capabilities` property as the end-user to have the complete possibilities with the collection. - * - * @return $this - */ - public function setAclWrite($aclWrite) - { - $this->container['aclWrite'] = $aclWrite; - - return $this; - } - - /** - * Gets aclAdmin - * - * @return bool - */ - public function getAclAdmin() - { - return $this->container['aclAdmin']; - } - - /** - * Sets aclAdmin - * - * @param bool $aclAdmin `True` if the current user can manage the current document (i.e. share, delete) If this is a right of a Collection, the capabilities of the associated user can be lower than this permission, check out the `capabilities` property as the end-user to have the complete possibilities with the collection. - * - * @return $this - */ - public function setAclAdmin($aclAdmin) - { - $this->container['aclAdmin'] = $aclAdmin; - - return $this; - } - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id The unique identifier of the permission - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets score - * - * @return string - */ - public function getScore() - { - return $this->container['score']; - } - - /** - * Sets score - * - * @param string $score If this object is a permission of a score, this property will contain the unique identifier of the score - * - * @return $this - */ - public function setScore($score) - { - $this->container['score'] = $score; - - return $this; - } - - /** - * Gets collection - * - * @return string - */ - public function getCollection() - { - return $this->container['collection']; - } - - /** - * Sets collection - * - * @param string $collection If this object is a permission of a collection, this property will contain the unique identifier of the collection - * - * @return $this - */ - public function setCollection($collection) - { - $this->container['collection'] = $collection; - - return $this; - } - - /** - * Gets user - * - * @return \Flat\APIClient\Model\UserPublic - */ - public function getUser() - { - return $this->container['user']; - } - - /** - * Sets user - * - * @param \Flat\APIClient\Model\UserPublic $user user - * - * @return $this - */ - public function setUser($user) - { - $this->container['user'] = $user; - - return $this; - } - - /** - * Gets group - * - * @return \Flat\APIClient\Model\Group - */ - public function getGroup() - { - return $this->container['group']; - } - - /** - * Sets group - * - * @param \Flat\APIClient\Model\Group $group group - * - * @return $this - */ - public function setGroup($group) - { - $this->container['group'] = $group; - - return $this; - } - - /** - * Gets userEmail - * - * @return string - */ - public function getUserEmail() - { - return $this->container['userEmail']; - } - - /** - * Sets userEmail - * - * @param string $userEmail If the collaborator is not a user of Flat yet, this field will contain his email. - * - * @return $this - */ - public function setUserEmail($userEmail) - { - $this->container['userEmail'] = $userEmail; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ResourceCollaboratorCreation.php b/lib/Model/ResourceCollaboratorCreation.php deleted file mode 100644 index c24c7d3..0000000 --- a/lib/Model/ResourceCollaboratorCreation.php +++ /dev/null @@ -1,482 +0,0 @@ - 'string', - 'group' => 'string', - 'userEmail' => 'string', - 'userToken' => 'string', - 'aclRead' => 'bool', - 'aclWrite' => 'bool', - 'aclAdmin' => 'bool' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'user' => null, - 'group' => null, - 'userEmail' => null, - 'userToken' => null, - 'aclRead' => null, - 'aclWrite' => null, - 'aclAdmin' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'user' => 'user', - 'group' => 'group', - 'userEmail' => 'userEmail', - 'userToken' => 'userToken', - 'aclRead' => 'aclRead', - 'aclWrite' => 'aclWrite', - 'aclAdmin' => 'aclAdmin' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'user' => 'setUser', - 'group' => 'setGroup', - 'userEmail' => 'setUserEmail', - 'userToken' => 'setUserToken', - 'aclRead' => 'setAclRead', - 'aclWrite' => 'setAclWrite', - 'aclAdmin' => 'setAclAdmin' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'user' => 'getUser', - 'group' => 'getGroup', - 'userEmail' => 'getUserEmail', - 'userToken' => 'getUserToken', - 'aclRead' => 'getAclRead', - 'aclWrite' => 'getAclWrite', - 'aclAdmin' => 'getAclAdmin' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['user'] = isset($data['user']) ? $data['user'] : null; - $this->container['group'] = isset($data['group']) ? $data['group'] : null; - $this->container['userEmail'] = isset($data['userEmail']) ? $data['userEmail'] : null; - $this->container['userToken'] = isset($data['userToken']) ? $data['userToken'] : null; - $this->container['aclRead'] = isset($data['aclRead']) ? $data['aclRead'] : true; - $this->container['aclWrite'] = isset($data['aclWrite']) ? $data['aclWrite'] : false; - $this->container['aclAdmin'] = isset($data['aclAdmin']) ? $data['aclAdmin'] : false; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets user - * - * @return string - */ - public function getUser() - { - return $this->container['user']; - } - - /** - * Sets user - * - * @param string $user The unique identifier of a Flat user - * - * @return $this - */ - public function setUser($user) - { - $this->container['user'] = $user; - - return $this; - } - - /** - * Gets group - * - * @return string - */ - public function getGroup() - { - return $this->container['group']; - } - - /** - * Sets group - * - * @param string $group The unique identifier of a Flat group - * - * @return $this - */ - public function setGroup($group) - { - $this->container['group'] = $group; - - return $this; - } - - /** - * Gets userEmail - * - * @return string - */ - public function getUserEmail() - { - return $this->container['userEmail']; - } - - /** - * Sets userEmail - * - * @param string $userEmail Fill this field to invite an individual user by email. - * - * @return $this - */ - public function setUserEmail($userEmail) - { - $this->container['userEmail'] = $userEmail; - - return $this; - } - - /** - * Gets userToken - * - * @return string - */ - public function getUserToken() - { - return $this->container['userToken']; - } - - /** - * Sets userToken - * - * @param string $userToken Token received in an invitation to join the score. - * - * @return $this - */ - public function setUserToken($userToken) - { - $this->container['userToken'] = $userToken; - - return $this; - } - - /** - * Gets aclRead - * - * @return bool - */ - public function getAclRead() - { - return $this->container['aclRead']; - } - - /** - * Sets aclRead - * - * @param bool $aclRead `True` if the related user can read the score. (probably true if the user has a permission on the document). - * - * @return $this - */ - public function setAclRead($aclRead) - { - $this->container['aclRead'] = $aclRead; - - return $this; - } - - /** - * Gets aclWrite - * - * @return bool - */ - public function getAclWrite() - { - return $this->container['aclWrite']; - } - - /** - * Sets aclWrite - * - * @param bool $aclWrite `True` if the related user can modify the score. - * - * @return $this - */ - public function setAclWrite($aclWrite) - { - $this->container['aclWrite'] = $aclWrite; - - return $this; - } - - /** - * Gets aclAdmin - * - * @return bool - */ - public function getAclAdmin() - { - return $this->container['aclAdmin']; - } - - /** - * Sets aclAdmin - * - * @param bool $aclAdmin `True` if the related user can can manage the current document, i.e. changing the document permissions and deleting the document - * - * @return $this - */ - public function setAclAdmin($aclAdmin) - { - $this->container['aclAdmin'] = $aclAdmin; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ResourceRights.php b/lib/Model/ResourceRights.php deleted file mode 100644 index f95bf96..0000000 --- a/lib/Model/ResourceRights.php +++ /dev/null @@ -1,362 +0,0 @@ - 'bool', - 'aclWrite' => 'bool', - 'aclAdmin' => 'bool' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'aclRead' => null, - 'aclWrite' => null, - 'aclAdmin' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'aclRead' => 'aclRead', - 'aclWrite' => 'aclWrite', - 'aclAdmin' => 'aclAdmin' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'aclRead' => 'setAclRead', - 'aclWrite' => 'setAclWrite', - 'aclAdmin' => 'setAclAdmin' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'aclRead' => 'getAclRead', - 'aclWrite' => 'getAclWrite', - 'aclAdmin' => 'getAclAdmin' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['aclRead'] = isset($data['aclRead']) ? $data['aclRead'] : false; - $this->container['aclWrite'] = isset($data['aclWrite']) ? $data['aclWrite'] : false; - $this->container['aclAdmin'] = isset($data['aclAdmin']) ? $data['aclAdmin'] : false; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets aclRead - * - * @return bool - */ - public function getAclRead() - { - return $this->container['aclRead']; - } - - /** - * Sets aclRead - * - * @param bool $aclRead `True` if the current user can read the current document - * - * @return $this - */ - public function setAclRead($aclRead) - { - $this->container['aclRead'] = $aclRead; - - return $this; - } - - /** - * Gets aclWrite - * - * @return bool - */ - public function getAclWrite() - { - return $this->container['aclWrite']; - } - - /** - * Sets aclWrite - * - * @param bool $aclWrite `True` if the current user can modify the current document. If this is a right of a Collection, the capabilities of the associated user can be lower than this permission, check out the `capabilities` property as the end-user to have the complete possibilities with the collection. - * - * @return $this - */ - public function setAclWrite($aclWrite) - { - $this->container['aclWrite'] = $aclWrite; - - return $this; - } - - /** - * Gets aclAdmin - * - * @return bool - */ - public function getAclAdmin() - { - return $this->container['aclAdmin']; - } - - /** - * Sets aclAdmin - * - * @param bool $aclAdmin `True` if the current user can manage the current document (i.e. share, delete) If this is a right of a Collection, the capabilities of the associated user can be lower than this permission, check out the `capabilities` property as the end-user to have the complete possibilities with the collection. - * - * @return $this - */ - public function setAclAdmin($aclAdmin) - { - $this->container['aclAdmin'] = $aclAdmin; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ResourceSharingKey.php b/lib/Model/ResourceSharingKey.php deleted file mode 100644 index fbbf8f7..0000000 --- a/lib/Model/ResourceSharingKey.php +++ /dev/null @@ -1,277 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ScoreComment.php b/lib/Model/ScoreComment.php deleted file mode 100644 index ac773d0..0000000 --- a/lib/Model/ScoreComment.php +++ /dev/null @@ -1,754 +0,0 @@ - 'string', - 'type' => 'string', - 'user' => 'string', - 'score' => 'string', - 'revision' => 'string', - 'replyTo' => 'string', - 'date' => '\DateTime', - 'modificationDate' => '\DateTime', - 'comment' => 'string', - 'rawComment' => 'string', - 'context' => '\Flat\APIClient\Model\ScoreCommentContext', - 'mentions' => 'string[]', - 'resolved' => 'bool', - 'resolvedBy' => 'string', - 'spam' => 'bool' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null, - 'type' => null, - 'user' => null, - 'score' => null, - 'revision' => null, - 'replyTo' => null, - 'date' => 'date-time', - 'modificationDate' => 'date-time', - 'comment' => null, - 'rawComment' => null, - 'context' => null, - 'mentions' => null, - 'resolved' => null, - 'resolvedBy' => null, - 'spam' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'type' => 'type', - 'user' => 'user', - 'score' => 'score', - 'revision' => 'revision', - 'replyTo' => 'replyTo', - 'date' => 'date', - 'modificationDate' => 'modificationDate', - 'comment' => 'comment', - 'rawComment' => 'rawComment', - 'context' => 'context', - 'mentions' => 'mentions', - 'resolved' => 'resolved', - 'resolvedBy' => 'resolvedBy', - 'spam' => 'spam' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'type' => 'setType', - 'user' => 'setUser', - 'score' => 'setScore', - 'revision' => 'setRevision', - 'replyTo' => 'setReplyTo', - 'date' => 'setDate', - 'modificationDate' => 'setModificationDate', - 'comment' => 'setComment', - 'rawComment' => 'setRawComment', - 'context' => 'setContext', - 'mentions' => 'setMentions', - 'resolved' => 'setResolved', - 'resolvedBy' => 'setResolvedBy', - 'spam' => 'setSpam' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'type' => 'getType', - 'user' => 'getUser', - 'score' => 'getScore', - 'revision' => 'getRevision', - 'replyTo' => 'getReplyTo', - 'date' => 'getDate', - 'modificationDate' => 'getModificationDate', - 'comment' => 'getComment', - 'rawComment' => 'getRawComment', - 'context' => 'getContext', - 'mentions' => 'getMentions', - 'resolved' => 'getResolved', - 'resolvedBy' => 'getResolvedBy', - 'spam' => 'getSpam' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const TYPE_DOCUMENT = 'document'; - const TYPE_INLINE = 'inline'; - - - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getTypeAllowableValues() - { - return [ - self::TYPE_DOCUMENT, - self::TYPE_INLINE, - ]; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['user'] = isset($data['user']) ? $data['user'] : null; - $this->container['score'] = isset($data['score']) ? $data['score'] : null; - $this->container['revision'] = isset($data['revision']) ? $data['revision'] : null; - $this->container['replyTo'] = isset($data['replyTo']) ? $data['replyTo'] : null; - $this->container['date'] = isset($data['date']) ? $data['date'] : null; - $this->container['modificationDate'] = isset($data['modificationDate']) ? $data['modificationDate'] : null; - $this->container['comment'] = isset($data['comment']) ? $data['comment'] : null; - $this->container['rawComment'] = isset($data['rawComment']) ? $data['rawComment'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['mentions'] = isset($data['mentions']) ? $data['mentions'] : null; - $this->container['resolved'] = isset($data['resolved']) ? $data['resolved'] : null; - $this->container['resolvedBy'] = isset($data['resolvedBy']) ? $data['resolvedBy'] : null; - $this->container['spam'] = isset($data['spam']) ? $data['spam'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value for 'type', must be one of '%s'", - implode("', '", $allowedValues) - ); - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id The comment unique identifier - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets type - * - * @return string - */ - public function getType() - { - return $this->container['type']; - } - - /** - * Sets type - * - * @param string $type The type of the comment - * - * @return $this - */ - public function setType($type) - { - $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($type) && !in_array($type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'type', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); - } - $this->container['type'] = $type; - - return $this; - } - - /** - * Gets user - * - * @return string - */ - public function getUser() - { - return $this->container['user']; - } - - /** - * Sets user - * - * @param string $user The author unique identifier - * - * @return $this - */ - public function setUser($user) - { - $this->container['user'] = $user; - - return $this; - } - - /** - * Gets score - * - * @return string - */ - public function getScore() - { - return $this->container['score']; - } - - /** - * Sets score - * - * @param string $score The unique identifier of the score where the comment was posted - * - * @return $this - */ - public function setScore($score) - { - $this->container['score'] = $score; - - return $this; - } - - /** - * Gets revision - * - * @return string - */ - public function getRevision() - { - return $this->container['revision']; - } - - /** - * Sets revision - * - * @param string $revision The unique identifier of revision the comment was posted - * - * @return $this - */ - public function setRevision($revision) - { - $this->container['revision'] = $revision; - - return $this; - } - - /** - * Gets replyTo - * - * @return string - */ - public function getReplyTo() - { - return $this->container['replyTo']; - } - - /** - * Sets replyTo - * - * @param string $replyTo When the comment is a reply to another comment, the unique identifier of the parent comment - * - * @return $this - */ - public function setReplyTo($replyTo) - { - $this->container['replyTo'] = $replyTo; - - return $this; - } - - /** - * Gets date - * - * @return \DateTime - */ - public function getDate() - { - return $this->container['date']; - } - - /** - * Sets date - * - * @param \DateTime $date The date when the comment was posted - * - * @return $this - */ - public function setDate($date) - { - $this->container['date'] = $date; - - return $this; - } - - /** - * Gets modificationDate - * - * @return \DateTime - */ - public function getModificationDate() - { - return $this->container['modificationDate']; - } - - /** - * Sets modificationDate - * - * @param \DateTime $modificationDate The date of the last comment modification - * - * @return $this - */ - public function setModificationDate($modificationDate) - { - $this->container['modificationDate'] = $modificationDate; - - return $this; - } - - /** - * Gets comment - * - * @return string - */ - public function getComment() - { - return $this->container['comment']; - } - - /** - * Sets comment - * - * @param string $comment The comment text that can includes mentions using the following format: `@[id:username]`. - * - * @return $this - */ - public function setComment($comment) - { - $this->container['comment'] = $comment; - - return $this; - } - - /** - * Gets rawComment - * - * @return string - */ - public function getRawComment() - { - return $this->container['rawComment']; - } - - /** - * Sets rawComment - * - * @param string $rawComment A raw version of the comment, that can be displayed without parsing the mentions. - * - * @return $this - */ - public function setRawComment($rawComment) - { - $this->container['rawComment'] = $rawComment; - - return $this; - } - - /** - * Gets context - * - * @return \Flat\APIClient\Model\ScoreCommentContext - */ - public function getContext() - { - return $this->container['context']; - } - - /** - * Sets context - * - * @param \Flat\APIClient\Model\ScoreCommentContext $context context - * - * @return $this - */ - public function setContext($context) - { - $this->container['context'] = $context; - - return $this; - } - - /** - * Gets mentions - * - * @return string[] - */ - public function getMentions() - { - return $this->container['mentions']; - } - - /** - * Sets mentions - * - * @param string[] $mentions The list of user identifier mentioned on the score - * - * @return $this - */ - public function setMentions($mentions) - { - $this->container['mentions'] = $mentions; - - return $this; - } - - /** - * Gets resolved - * - * @return bool - */ - public function getResolved() - { - return $this->container['resolved']; - } - - /** - * Sets resolved - * - * @param bool $resolved For inline comments, the comment can be marked as resolved and will be hidden in the future responses - * - * @return $this - */ - public function setResolved($resolved) - { - $this->container['resolved'] = $resolved; - - return $this; - } - - /** - * Gets resolvedBy - * - * @return string - */ - public function getResolvedBy() - { - return $this->container['resolvedBy']; - } - - /** - * Sets resolvedBy - * - * @param string $resolvedBy If the user is marked as resolved, this will contain the unique identifier of the User who marked this comment as resolved - * - * @return $this - */ - public function setResolvedBy($resolvedBy) - { - $this->container['resolvedBy'] = $resolvedBy; - - return $this; - } - - /** - * Gets spam - * - * @return bool - */ - public function getSpam() - { - return $this->container['spam']; - } - - /** - * Sets spam - * - * @param bool $spam `true if the message has been detected as spam and hidden from other users - * - * @return $this - */ - public function setSpam($spam) - { - $this->container['spam'] = $spam; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ScoreCommentContext.php b/lib/Model/ScoreCommentContext.php deleted file mode 100644 index 9a2cd8b..0000000 --- a/lib/Model/ScoreCommentContext.php +++ /dev/null @@ -1,503 +0,0 @@ - 'string', - 'staffIdx' => 'float', - 'measureUuids' => 'string[]', - 'startTimePos' => 'float', - 'stopTimePos' => 'float', - 'startDpq' => 'float', - 'stopDpq' => 'float' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'partUuid' => null, - 'staffIdx' => null, - 'measureUuids' => null, - 'startTimePos' => null, - 'stopTimePos' => null, - 'startDpq' => null, - 'stopDpq' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'partUuid' => 'partUuid', - 'staffIdx' => 'staffIdx', - 'measureUuids' => 'measureUuids', - 'startTimePos' => 'startTimePos', - 'stopTimePos' => 'stopTimePos', - 'startDpq' => 'startDpq', - 'stopDpq' => 'stopDpq' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'partUuid' => 'setPartUuid', - 'staffIdx' => 'setStaffIdx', - 'measureUuids' => 'setMeasureUuids', - 'startTimePos' => 'setStartTimePos', - 'stopTimePos' => 'setStopTimePos', - 'startDpq' => 'setStartDpq', - 'stopDpq' => 'setStopDpq' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'partUuid' => 'getPartUuid', - 'staffIdx' => 'getStaffIdx', - 'measureUuids' => 'getMeasureUuids', - 'startTimePos' => 'getStartTimePos', - 'stopTimePos' => 'getStopTimePos', - 'startDpq' => 'getStartDpq', - 'stopDpq' => 'getStopDpq' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['partUuid'] = isset($data['partUuid']) ? $data['partUuid'] : null; - $this->container['staffIdx'] = isset($data['staffIdx']) ? $data['staffIdx'] : null; - $this->container['measureUuids'] = isset($data['measureUuids']) ? $data['measureUuids'] : null; - $this->container['startTimePos'] = isset($data['startTimePos']) ? $data['startTimePos'] : null; - $this->container['stopTimePos'] = isset($data['stopTimePos']) ? $data['stopTimePos'] : null; - $this->container['startDpq'] = isset($data['startDpq']) ? $data['startDpq'] : null; - $this->container['stopDpq'] = isset($data['stopDpq']) ? $data['stopDpq'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['partUuid'] === null) { - $invalidProperties[] = "'partUuid' can't be null"; - } - if ($this->container['staffIdx'] === null) { - $invalidProperties[] = "'staffIdx' can't be null"; - } - if ($this->container['measureUuids'] === null) { - $invalidProperties[] = "'measureUuids' can't be null"; - } - if ($this->container['startTimePos'] === null) { - $invalidProperties[] = "'startTimePos' can't be null"; - } - if ($this->container['stopTimePos'] === null) { - $invalidProperties[] = "'stopTimePos' can't be null"; - } - if ($this->container['startDpq'] === null) { - $invalidProperties[] = "'startDpq' can't be null"; - } - if ($this->container['stopDpq'] === null) { - $invalidProperties[] = "'stopDpq' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets partUuid - * - * @return string - */ - public function getPartUuid() - { - return $this->container['partUuid']; - } - - /** - * Sets partUuid - * - * @param string $partUuid The unique identifier (UUID) of the score part - * - * @return $this - */ - public function setPartUuid($partUuid) - { - $this->container['partUuid'] = $partUuid; - - return $this; - } - - /** - * Gets staffIdx - * - * @return float - */ - public function getStaffIdx() - { - return $this->container['staffIdx']; - } - - /** - * Sets staffIdx - * - * @param float $staffIdx The identififer of the staff - * - * @return $this - */ - public function setStaffIdx($staffIdx) - { - $this->container['staffIdx'] = $staffIdx; - - return $this; - } - - /** - * Gets measureUuids - * - * @return string[] - */ - public function getMeasureUuids() - { - return $this->container['measureUuids']; - } - - /** - * Sets measureUuids - * - * @param string[] $measureUuids The list of measure UUIds - * - * @return $this - */ - public function setMeasureUuids($measureUuids) - { - $this->container['measureUuids'] = $measureUuids; - - return $this; - } - - /** - * Gets startTimePos - * - * @return float - */ - public function getStartTimePos() - { - return $this->container['startTimePos']; - } - - /** - * Sets startTimePos - * - * @param float $startTimePos startTimePos - * - * @return $this - */ - public function setStartTimePos($startTimePos) - { - $this->container['startTimePos'] = $startTimePos; - - return $this; - } - - /** - * Gets stopTimePos - * - * @return float - */ - public function getStopTimePos() - { - return $this->container['stopTimePos']; - } - - /** - * Sets stopTimePos - * - * @param float $stopTimePos stopTimePos - * - * @return $this - */ - public function setStopTimePos($stopTimePos) - { - $this->container['stopTimePos'] = $stopTimePos; - - return $this; - } - - /** - * Gets startDpq - * - * @return float - */ - public function getStartDpq() - { - return $this->container['startDpq']; - } - - /** - * Sets startDpq - * - * @param float $startDpq startDpq - * - * @return $this - */ - public function setStartDpq($startDpq) - { - $this->container['startDpq'] = $startDpq; - - return $this; - } - - /** - * Gets stopDpq - * - * @return float - */ - public function getStopDpq() - { - return $this->container['stopDpq']; - } - - /** - * Sets stopDpq - * - * @param float $stopDpq stopDpq - * - * @return $this - */ - public function setStopDpq($stopDpq) - { - $this->container['stopDpq'] = $stopDpq; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ScoreCommentCreation.php b/lib/Model/ScoreCommentCreation.php deleted file mode 100644 index cdb03fd..0000000 --- a/lib/Model/ScoreCommentCreation.php +++ /dev/null @@ -1,455 +0,0 @@ - 'string', - 'comment' => 'string', - 'rawComment' => 'string', - 'mentions' => 'string[]', - 'replyTo' => 'string', - 'context' => '\Flat\APIClient\Model\ScoreCommentContext' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'revision' => null, - 'comment' => null, - 'rawComment' => null, - 'mentions' => null, - 'replyTo' => null, - 'context' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'revision' => 'revision', - 'comment' => 'comment', - 'rawComment' => 'rawComment', - 'mentions' => 'mentions', - 'replyTo' => 'replyTo', - 'context' => 'context' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'revision' => 'setRevision', - 'comment' => 'setComment', - 'rawComment' => 'setRawComment', - 'mentions' => 'setMentions', - 'replyTo' => 'setReplyTo', - 'context' => 'setContext' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'revision' => 'getRevision', - 'comment' => 'getComment', - 'rawComment' => 'getRawComment', - 'mentions' => 'getMentions', - 'replyTo' => 'getReplyTo', - 'context' => 'getContext' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['revision'] = isset($data['revision']) ? $data['revision'] : null; - $this->container['comment'] = isset($data['comment']) ? $data['comment'] : null; - $this->container['rawComment'] = isset($data['rawComment']) ? $data['rawComment'] : null; - $this->container['mentions'] = isset($data['mentions']) ? $data['mentions'] : null; - $this->container['replyTo'] = isset($data['replyTo']) ? $data['replyTo'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['comment'] === null) { - $invalidProperties[] = "'comment' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets revision - * - * @return string - */ - public function getRevision() - { - return $this->container['revision']; - } - - /** - * Sets revision - * - * @param string $revision The unique indentifier of the revision of the score where the comment was added. If this property is unspecified or contains \"last\", the API will automatically take the last revision created. - * - * @return $this - */ - public function setRevision($revision) - { - $this->container['revision'] = $revision; - - return $this; - } - - /** - * Gets comment - * - * @return string - */ - public function getComment() - { - return $this->container['comment']; - } - - /** - * Sets comment - * - * @param string $comment The comment text that can includes mentions using the following format: `@[id:username]`. - * - * @return $this - */ - public function setComment($comment) - { - $this->container['comment'] = $comment; - - return $this; - } - - /** - * Gets rawComment - * - * @return string - */ - public function getRawComment() - { - return $this->container['rawComment']; - } - - /** - * Sets rawComment - * - * @param string $rawComment A raw version of the comment, that can be displayed without the mentions. If you use mentions, this property must be set. - * - * @return $this - */ - public function setRawComment($rawComment) - { - $this->container['rawComment'] = $rawComment; - - return $this; - } - - /** - * Gets mentions - * - * @return string[] - */ - public function getMentions() - { - return $this->container['mentions']; - } - - /** - * Sets mentions - * - * @param string[] $mentions The list of user identifiers mentioned in this comment - * - * @return $this - */ - public function setMentions($mentions) - { - $this->container['mentions'] = $mentions; - - return $this; - } - - /** - * Gets replyTo - * - * @return string - */ - public function getReplyTo() - { - return $this->container['replyTo']; - } - - /** - * Sets replyTo - * - * @param string $replyTo When the comment is a reply to another comment, the unique identifier of the parent comment - * - * @return $this - */ - public function setReplyTo($replyTo) - { - $this->container['replyTo'] = $replyTo; - - return $this; - } - - /** - * Gets context - * - * @return \Flat\APIClient\Model\ScoreCommentContext - */ - public function getContext() - { - return $this->container['context']; - } - - /** - * Sets context - * - * @param \Flat\APIClient\Model\ScoreCommentContext $context context - * - * @return $this - */ - public function setContext($context) - { - $this->container['context'] = $context; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ScoreCommentUpdate.php b/lib/Model/ScoreCommentUpdate.php deleted file mode 100644 index bde02ef..0000000 --- a/lib/Model/ScoreCommentUpdate.php +++ /dev/null @@ -1,422 +0,0 @@ - 'string', - 'comment' => 'string', - 'rawComment' => 'string', - 'context' => '\Flat\APIClient\Model\ScoreCommentContext' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'revision' => null, - 'comment' => null, - 'rawComment' => null, - 'context' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'revision' => 'revision', - 'comment' => 'comment', - 'rawComment' => 'rawComment', - 'context' => 'context' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'revision' => 'setRevision', - 'comment' => 'setComment', - 'rawComment' => 'setRawComment', - 'context' => 'setContext' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'revision' => 'getRevision', - 'comment' => 'getComment', - 'rawComment' => 'getRawComment', - 'context' => 'getContext' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['revision'] = isset($data['revision']) ? $data['revision'] : null; - $this->container['comment'] = isset($data['comment']) ? $data['comment'] : null; - $this->container['rawComment'] = isset($data['rawComment']) ? $data['rawComment'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if (!is_null($this->container['comment']) && (mb_strlen($this->container['comment']) > 10000)) { - $invalidProperties[] = "invalid value for 'comment', the character length must be smaller than or equal to 10000."; - } - - if (!is_null($this->container['comment']) && (mb_strlen($this->container['comment']) < 1)) { - $invalidProperties[] = "invalid value for 'comment', the character length must be bigger than or equal to 1."; - } - - if (!is_null($this->container['rawComment']) && (mb_strlen($this->container['rawComment']) > 10000)) { - $invalidProperties[] = "invalid value for 'rawComment', the character length must be smaller than or equal to 10000."; - } - - if (!is_null($this->container['rawComment']) && (mb_strlen($this->container['rawComment']) < 1)) { - $invalidProperties[] = "invalid value for 'rawComment', the character length must be bigger than or equal to 1."; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets revision - * - * @return string - */ - public function getRevision() - { - return $this->container['revision']; - } - - /** - * Sets revision - * - * @param string $revision The unique indentifier of the revision of the score where the comment was added. If this property is unspecified or contains \"last\", the API will automatically take the last revision created. - * - * @return $this - */ - public function setRevision($revision) - { - $this->container['revision'] = $revision; - - return $this; - } - - /** - * Gets comment - * - * @return string - */ - public function getComment() - { - return $this->container['comment']; - } - - /** - * Sets comment - * - * @param string $comment The comment text that can includes mentions using the following format: `@[id:username]`. - * - * @return $this - */ - public function setComment($comment) - { - if (!is_null($comment) && (mb_strlen($comment) > 10000)) { - throw new \InvalidArgumentException('invalid length for $comment when calling ScoreCommentUpdate., must be smaller than or equal to 10000.'); - } - if (!is_null($comment) && (mb_strlen($comment) < 1)) { - throw new \InvalidArgumentException('invalid length for $comment when calling ScoreCommentUpdate., must be bigger than or equal to 1.'); - } - - $this->container['comment'] = $comment; - - return $this; - } - - /** - * Gets rawComment - * - * @return string - */ - public function getRawComment() - { - return $this->container['rawComment']; - } - - /** - * Sets rawComment - * - * @param string $rawComment A raw version of the comment, that can be displayed without the mentions. If you use mentions, this property must be set. - * - * @return $this - */ - public function setRawComment($rawComment) - { - if (!is_null($rawComment) && (mb_strlen($rawComment) > 10000)) { - throw new \InvalidArgumentException('invalid length for $rawComment when calling ScoreCommentUpdate., must be smaller than or equal to 10000.'); - } - if (!is_null($rawComment) && (mb_strlen($rawComment) < 1)) { - throw new \InvalidArgumentException('invalid length for $rawComment when calling ScoreCommentUpdate., must be bigger than or equal to 1.'); - } - - $this->container['rawComment'] = $rawComment; - - return $this; - } - - /** - * Gets context - * - * @return \Flat\APIClient\Model\ScoreCommentContext - */ - public function getContext() - { - return $this->container['context']; - } - - /** - * Sets context - * - * @param \Flat\APIClient\Model\ScoreCommentContext $context context - * - * @return $this - */ - public function setContext($context) - { - $this->container['context'] = $context; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ScoreCommentsCounts.php b/lib/Model/ScoreCommentsCounts.php deleted file mode 100644 index b59555f..0000000 --- a/lib/Model/ScoreCommentsCounts.php +++ /dev/null @@ -1,392 +0,0 @@ - 'float', - 'unique' => 'float', - 'weekly' => 'float', - 'monthly' => 'float' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'total' => null, - 'unique' => null, - 'weekly' => null, - 'monthly' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'total' => 'total', - 'unique' => 'unique', - 'weekly' => 'weekly', - 'monthly' => 'monthly' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'total' => 'setTotal', - 'unique' => 'setUnique', - 'weekly' => 'setWeekly', - 'monthly' => 'setMonthly' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'total' => 'getTotal', - 'unique' => 'getUnique', - 'weekly' => 'getWeekly', - 'monthly' => 'getMonthly' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['total'] = isset($data['total']) ? $data['total'] : null; - $this->container['unique'] = isset($data['unique']) ? $data['unique'] : null; - $this->container['weekly'] = isset($data['weekly']) ? $data['weekly'] : null; - $this->container['monthly'] = isset($data['monthly']) ? $data['monthly'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets total - * - * @return float - */ - public function getTotal() - { - return $this->container['total']; - } - - /** - * Sets total - * - * @param float $total The total number of comments added on the score - * - * @return $this - */ - public function setTotal($total) - { - $this->container['total'] = $total; - - return $this; - } - - /** - * Gets unique - * - * @return float - */ - public function getUnique() - { - return $this->container['unique']; - } - - /** - * Sets unique - * - * @param float $unique The unique (1/user) number of comments added on the score - * - * @return $this - */ - public function setUnique($unique) - { - $this->container['unique'] = $unique; - - return $this; - } - - /** - * Gets weekly - * - * @return float - */ - public function getWeekly() - { - return $this->container['weekly']; - } - - /** - * Sets weekly - * - * @param float $weekly The weekly unique number of comments added on the score - * - * @return $this - */ - public function setWeekly($weekly) - { - $this->container['weekly'] = $weekly; - - return $this; - } - - /** - * Gets monthly - * - * @return float - */ - public function getMonthly() - { - return $this->container['monthly']; - } - - /** - * Sets monthly - * - * @param float $monthly The monthly unique number of comments added on the score - * - * @return $this - */ - public function setMonthly($monthly) - { - $this->container['monthly'] = $monthly; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ScoreCreation.php b/lib/Model/ScoreCreation.php deleted file mode 100644 index e35be4c..0000000 --- a/lib/Model/ScoreCreation.php +++ /dev/null @@ -1,485 +0,0 @@ - 'string', - 'privacy' => '\Flat\APIClient\Model\ScorePrivacy', - 'data' => '\Flat\APIClient\Model\ScoreData', - 'dataEncoding' => '\Flat\APIClient\Model\ScoreDataEncoding', - 'source' => '\Flat\APIClient\Model\ScoreSource', - 'collection' => 'string', - 'googleDriveFolder' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'title' => null, - 'privacy' => null, - 'data' => null, - 'dataEncoding' => null, - 'source' => null, - 'collection' => null, - 'googleDriveFolder' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'title' => 'title', - 'privacy' => 'privacy', - 'data' => 'data', - 'dataEncoding' => 'dataEncoding', - 'source' => 'source', - 'collection' => 'collection', - 'googleDriveFolder' => 'googleDriveFolder' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'title' => 'setTitle', - 'privacy' => 'setPrivacy', - 'data' => 'setData', - 'dataEncoding' => 'setDataEncoding', - 'source' => 'setSource', - 'collection' => 'setCollection', - 'googleDriveFolder' => 'setGoogleDriveFolder' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'title' => 'getTitle', - 'privacy' => 'getPrivacy', - 'data' => 'getData', - 'dataEncoding' => 'getDataEncoding', - 'source' => 'getSource', - 'collection' => 'getCollection', - 'googleDriveFolder' => 'getGoogleDriveFolder' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['title'] = isset($data['title']) ? $data['title'] : null; - $this->container['privacy'] = isset($data['privacy']) ? $data['privacy'] : null; - $this->container['data'] = isset($data['data']) ? $data['data'] : null; - $this->container['dataEncoding'] = isset($data['dataEncoding']) ? $data['dataEncoding'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['collection'] = isset($data['collection']) ? $data['collection'] : null; - $this->container['googleDriveFolder'] = isset($data['googleDriveFolder']) ? $data['googleDriveFolder'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['privacy'] === null) { - $invalidProperties[] = "'privacy' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets title - * - * @return string - */ - public function getTitle() - { - return $this->container['title']; - } - - /** - * Sets title - * - * @param string $title The title of the new score. If the title is too long, the API may trim this one. If this title is not specified, the API will try to (in this order): - Use the name of the file for files from a specified `source` (e.g. Google Drive) - Use the title contained in the file (e.g. [`movement-title`](https://usermanuals.musicxml.com/MusicXML/Content/EL-MusicXML-movement-title.htm) or [`credit-words`](https://usermanuals.musicxml.com/MusicXML/Content/EL-MusicXML-credit-words.htm) for [MusicXML](http://www.musicxml.com/) files). - Set a default title (e.g. \"New Music Score\") - * - * @return $this - */ - public function setTitle($title) - { - $this->container['title'] = $title; - - return $this; - } - - /** - * Gets privacy - * - * @return \Flat\APIClient\Model\ScorePrivacy - */ - public function getPrivacy() - { - return $this->container['privacy']; - } - - /** - * Sets privacy - * - * @param \Flat\APIClient\Model\ScorePrivacy $privacy privacy - * - * @return $this - */ - public function setPrivacy($privacy) - { - $this->container['privacy'] = $privacy; - - return $this; - } - - /** - * Gets data - * - * @return \Flat\APIClient\Model\ScoreData - */ - public function getData() - { - return $this->container['data']; - } - - /** - * Sets data - * - * @param \Flat\APIClient\Model\ScoreData $data data - * - * @return $this - */ - public function setData($data) - { - $this->container['data'] = $data; - - return $this; - } - - /** - * Gets dataEncoding - * - * @return \Flat\APIClient\Model\ScoreDataEncoding - */ - public function getDataEncoding() - { - return $this->container['dataEncoding']; - } - - /** - * Sets dataEncoding - * - * @param \Flat\APIClient\Model\ScoreDataEncoding $dataEncoding dataEncoding - * - * @return $this - */ - public function setDataEncoding($dataEncoding) - { - $this->container['dataEncoding'] = $dataEncoding; - - return $this; - } - - /** - * Gets source - * - * @return \Flat\APIClient\Model\ScoreSource - */ - public function getSource() - { - return $this->container['source']; - } - - /** - * Sets source - * - * @param \Flat\APIClient\Model\ScoreSource $source source - * - * @return $this - */ - public function setSource($source) - { - $this->container['source'] = $source; - - return $this; - } - - /** - * Gets collection - * - * @return string - */ - public function getCollection() - { - return $this->container['collection']; - } - - /** - * Sets collection - * - * @param string $collection Unique identifier of a collection where the score will be created. If no collection identifier is provided, the score will be stored in the `root` directory. - * - * @return $this - */ - public function setCollection($collection) - { - $this->container['collection'] = $collection; - - return $this; - } - - /** - * Gets googleDriveFolder - * - * @return string - */ - public function getGoogleDriveFolder() - { - return $this->container['googleDriveFolder']; - } - - /** - * Sets googleDriveFolder - * - * @param string $googleDriveFolder If the user uses Google Drive and this properties is specified, the file will be created in this directory. The currently user creating the file must be granted to write in this directory. - * - * @return $this - */ - public function setGoogleDriveFolder($googleDriveFolder) - { - $this->container['googleDriveFolder'] = $googleDriveFolder; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ScoreCreationType.php b/lib/Model/ScoreCreationType.php deleted file mode 100644 index 9454dca..0000000 --- a/lib/Model/ScoreCreationType.php +++ /dev/null @@ -1,65 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ScoreDataEncoding.php b/lib/Model/ScoreDataEncoding.php deleted file mode 100644 index ff59cff..0000000 --- a/lib/Model/ScoreDataEncoding.php +++ /dev/null @@ -1,61 +0,0 @@ - 'string', - 'sharingKey' => 'string', - 'title' => 'string', - 'privacy' => '\Flat\APIClient\Model\ScorePrivacy', - 'user' => '\Flat\APIClient\Model\UserPublicSummary', - 'htmlUrl' => 'string', - 'subtitle' => 'string', - 'lyricist' => 'string', - 'composer' => 'string', - 'description' => 'string', - 'tags' => 'string[]', - 'creationType' => '\Flat\APIClient\Model\ScoreCreationType', - 'license' => '\Flat\APIClient\Model\ScoreLicense', - 'licenseText' => 'string', - 'durationTime' => 'int', - 'numberMeasures' => 'int', - 'mainTempoQpm' => 'int', - 'rights' => '\Flat\APIClient\Model\ResourceRights', - 'collaborators' => '\Flat\APIClient\Model\ResourceCollaborator[]', - 'creationDate' => '\DateTime', - 'modificationDate' => '\DateTime', - 'publicationDate' => '\DateTime', - 'organization' => 'string', - 'parentScore' => 'string', - 'instruments' => 'string[]', - 'googleDriveFileId' => 'string', - 'likes' => '\Flat\APIClient\Model\ScoreLikesCounts', - 'comments' => '\Flat\APIClient\Model\ScoreCommentsCounts', - 'views' => '\Flat\APIClient\Model\ScoreViewsCounts' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null, - 'sharingKey' => null, - 'title' => null, - 'privacy' => null, - 'user' => null, - 'htmlUrl' => 'url', - 'subtitle' => null, - 'lyricist' => null, - 'composer' => null, - 'description' => null, - 'tags' => null, - 'creationType' => null, - 'license' => null, - 'licenseText' => null, - 'durationTime' => null, - 'numberMeasures' => null, - 'mainTempoQpm' => null, - 'rights' => null, - 'collaborators' => null, - 'creationDate' => 'date-time', - 'modificationDate' => 'date-time', - 'publicationDate' => 'date-time', - 'organization' => null, - 'parentScore' => null, - 'instruments' => null, - 'googleDriveFileId' => null, - 'likes' => null, - 'comments' => null, - 'views' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'sharingKey' => 'sharingKey', - 'title' => 'title', - 'privacy' => 'privacy', - 'user' => 'user', - 'htmlUrl' => 'htmlUrl', - 'subtitle' => 'subtitle', - 'lyricist' => 'lyricist', - 'composer' => 'composer', - 'description' => 'description', - 'tags' => 'tags', - 'creationType' => 'creationType', - 'license' => 'license', - 'licenseText' => 'licenseText', - 'durationTime' => 'durationTime', - 'numberMeasures' => 'numberMeasures', - 'mainTempoQpm' => 'mainTempoQpm', - 'rights' => 'rights', - 'collaborators' => 'collaborators', - 'creationDate' => 'creationDate', - 'modificationDate' => 'modificationDate', - 'publicationDate' => 'publicationDate', - 'organization' => 'organization', - 'parentScore' => 'parentScore', - 'instruments' => 'instruments', - 'googleDriveFileId' => 'googleDriveFileId', - 'likes' => 'likes', - 'comments' => 'comments', - 'views' => 'views' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'sharingKey' => 'setSharingKey', - 'title' => 'setTitle', - 'privacy' => 'setPrivacy', - 'user' => 'setUser', - 'htmlUrl' => 'setHtmlUrl', - 'subtitle' => 'setSubtitle', - 'lyricist' => 'setLyricist', - 'composer' => 'setComposer', - 'description' => 'setDescription', - 'tags' => 'setTags', - 'creationType' => 'setCreationType', - 'license' => 'setLicense', - 'licenseText' => 'setLicenseText', - 'durationTime' => 'setDurationTime', - 'numberMeasures' => 'setNumberMeasures', - 'mainTempoQpm' => 'setMainTempoQpm', - 'rights' => 'setRights', - 'collaborators' => 'setCollaborators', - 'creationDate' => 'setCreationDate', - 'modificationDate' => 'setModificationDate', - 'publicationDate' => 'setPublicationDate', - 'organization' => 'setOrganization', - 'parentScore' => 'setParentScore', - 'instruments' => 'setInstruments', - 'googleDriveFileId' => 'setGoogleDriveFileId', - 'likes' => 'setLikes', - 'comments' => 'setComments', - 'views' => 'setViews' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'sharingKey' => 'getSharingKey', - 'title' => 'getTitle', - 'privacy' => 'getPrivacy', - 'user' => 'getUser', - 'htmlUrl' => 'getHtmlUrl', - 'subtitle' => 'getSubtitle', - 'lyricist' => 'getLyricist', - 'composer' => 'getComposer', - 'description' => 'getDescription', - 'tags' => 'getTags', - 'creationType' => 'getCreationType', - 'license' => 'getLicense', - 'licenseText' => 'getLicenseText', - 'durationTime' => 'getDurationTime', - 'numberMeasures' => 'getNumberMeasures', - 'mainTempoQpm' => 'getMainTempoQpm', - 'rights' => 'getRights', - 'collaborators' => 'getCollaborators', - 'creationDate' => 'getCreationDate', - 'modificationDate' => 'getModificationDate', - 'publicationDate' => 'getPublicationDate', - 'organization' => 'getOrganization', - 'parentScore' => 'getParentScore', - 'instruments' => 'getInstruments', - 'googleDriveFileId' => 'getGoogleDriveFileId', - 'likes' => 'getLikes', - 'comments' => 'getComments', - 'views' => 'getViews' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['sharingKey'] = isset($data['sharingKey']) ? $data['sharingKey'] : null; - $this->container['title'] = isset($data['title']) ? $data['title'] : null; - $this->container['privacy'] = isset($data['privacy']) ? $data['privacy'] : null; - $this->container['user'] = isset($data['user']) ? $data['user'] : null; - $this->container['htmlUrl'] = isset($data['htmlUrl']) ? $data['htmlUrl'] : null; - $this->container['subtitle'] = isset($data['subtitle']) ? $data['subtitle'] : null; - $this->container['lyricist'] = isset($data['lyricist']) ? $data['lyricist'] : null; - $this->container['composer'] = isset($data['composer']) ? $data['composer'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; - $this->container['tags'] = isset($data['tags']) ? $data['tags'] : null; - $this->container['creationType'] = isset($data['creationType']) ? $data['creationType'] : null; - $this->container['license'] = isset($data['license']) ? $data['license'] : null; - $this->container['licenseText'] = isset($data['licenseText']) ? $data['licenseText'] : null; - $this->container['durationTime'] = isset($data['durationTime']) ? $data['durationTime'] : null; - $this->container['numberMeasures'] = isset($data['numberMeasures']) ? $data['numberMeasures'] : null; - $this->container['mainTempoQpm'] = isset($data['mainTempoQpm']) ? $data['mainTempoQpm'] : null; - $this->container['rights'] = isset($data['rights']) ? $data['rights'] : null; - $this->container['collaborators'] = isset($data['collaborators']) ? $data['collaborators'] : null; - $this->container['creationDate'] = isset($data['creationDate']) ? $data['creationDate'] : null; - $this->container['modificationDate'] = isset($data['modificationDate']) ? $data['modificationDate'] : null; - $this->container['publicationDate'] = isset($data['publicationDate']) ? $data['publicationDate'] : null; - $this->container['organization'] = isset($data['organization']) ? $data['organization'] : null; - $this->container['parentScore'] = isset($data['parentScore']) ? $data['parentScore'] : null; - $this->container['instruments'] = isset($data['instruments']) ? $data['instruments'] : null; - $this->container['googleDriveFileId'] = isset($data['googleDriveFileId']) ? $data['googleDriveFileId'] : null; - $this->container['likes'] = isset($data['likes']) ? $data['likes'] : null; - $this->container['comments'] = isset($data['comments']) ? $data['comments'] : null; - $this->container['views'] = isset($data['views']) ? $data['views'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id The unique identifier of the score - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets sharingKey - * - * @return string - */ - public function getSharingKey() - { - return $this->container['sharingKey']; - } - - /** - * Sets sharingKey - * - * @param string $sharingKey The private sharing key of the score (available when the `privacy` mode is set to `privateLink`) - * - * @return $this - */ - public function setSharingKey($sharingKey) - { - $this->container['sharingKey'] = $sharingKey; - - return $this; - } - - /** - * Gets title - * - * @return string - */ - public function getTitle() - { - return $this->container['title']; - } - - /** - * Sets title - * - * @param string $title The title of the score - * - * @return $this - */ - public function setTitle($title) - { - $this->container['title'] = $title; - - return $this; - } - - /** - * Gets privacy - * - * @return \Flat\APIClient\Model\ScorePrivacy - */ - public function getPrivacy() - { - return $this->container['privacy']; - } - - /** - * Sets privacy - * - * @param \Flat\APIClient\Model\ScorePrivacy $privacy privacy - * - * @return $this - */ - public function setPrivacy($privacy) - { - $this->container['privacy'] = $privacy; - - return $this; - } - - /** - * Gets user - * - * @return \Flat\APIClient\Model\UserPublicSummary - */ - public function getUser() - { - return $this->container['user']; - } - - /** - * Sets user - * - * @param \Flat\APIClient\Model\UserPublicSummary $user user - * - * @return $this - */ - public function setUser($user) - { - $this->container['user'] = $user; - - return $this; - } - - /** - * Gets htmlUrl - * - * @return string - */ - public function getHtmlUrl() - { - return $this->container['htmlUrl']; - } - - /** - * Sets htmlUrl - * - * @param string $htmlUrl The url where the score can be viewed in a web browser - * - * @return $this - */ - public function setHtmlUrl($htmlUrl) - { - $this->container['htmlUrl'] = $htmlUrl; - - return $this; - } - - /** - * Gets subtitle - * - * @return string - */ - public function getSubtitle() - { - return $this->container['subtitle']; - } - - /** - * Sets subtitle - * - * @param string $subtitle Subtitle of the score - * - * @return $this - */ - public function setSubtitle($subtitle) - { - $this->container['subtitle'] = $subtitle; - - return $this; - } - - /** - * Gets lyricist - * - * @return string - */ - public function getLyricist() - { - return $this->container['lyricist']; - } - - /** - * Sets lyricist - * - * @param string $lyricist Lyricist of the score - * - * @return $this - */ - public function setLyricist($lyricist) - { - $this->container['lyricist'] = $lyricist; - - return $this; - } - - /** - * Gets composer - * - * @return string - */ - public function getComposer() - { - return $this->container['composer']; - } - - /** - * Sets composer - * - * @param string $composer Composer of the score - * - * @return $this - */ - public function setComposer($composer) - { - $this->container['composer'] = $composer; - - return $this; - } - - /** - * Gets description - * - * @return string - */ - public function getDescription() - { - return $this->container['description']; - } - - /** - * Sets description - * - * @param string $description Description of the creation - * - * @return $this - */ - public function setDescription($description) - { - $this->container['description'] = $description; - - return $this; - } - - /** - * Gets tags - * - * @return string[] - */ - public function getTags() - { - return $this->container['tags']; - } - - /** - * Sets tags - * - * @param string[] $tags Tags describing the score - * - * @return $this - */ - public function setTags($tags) - { - $this->container['tags'] = $tags; - - return $this; - } - - /** - * Gets creationType - * - * @return \Flat\APIClient\Model\ScoreCreationType - */ - public function getCreationType() - { - return $this->container['creationType']; - } - - /** - * Sets creationType - * - * @param \Flat\APIClient\Model\ScoreCreationType $creationType creationType - * - * @return $this - */ - public function setCreationType($creationType) - { - $this->container['creationType'] = $creationType; - - return $this; - } - - /** - * Gets license - * - * @return \Flat\APIClient\Model\ScoreLicense - */ - public function getLicense() - { - return $this->container['license']; - } - - /** - * Sets license - * - * @param \Flat\APIClient\Model\ScoreLicense $license license - * - * @return $this - */ - public function setLicense($license) - { - $this->container['license'] = $license; - - return $this; - } - - /** - * Gets licenseText - * - * @return string - */ - public function getLicenseText() - { - return $this->container['licenseText']; - } - - /** - * Sets licenseText - * - * @param string $licenseText Additional license text written on the exported/printed score - * - * @return $this - */ - public function setLicenseText($licenseText) - { - $this->container['licenseText'] = $licenseText; - - return $this; - } - - /** - * Gets durationTime - * - * @return int - */ - public function getDurationTime() - { - return $this->container['durationTime']; - } - - /** - * Sets durationTime - * - * @param int $durationTime In seconds, an approximative duration of the score - * - * @return $this - */ - public function setDurationTime($durationTime) - { - $this->container['durationTime'] = $durationTime; - - return $this; - } - - /** - * Gets numberMeasures - * - * @return int - */ - public function getNumberMeasures() - { - return $this->container['numberMeasures']; - } - - /** - * Sets numberMeasures - * - * @param int $numberMeasures The number of measures in the score - * - * @return $this - */ - public function setNumberMeasures($numberMeasures) - { - $this->container['numberMeasures'] = $numberMeasures; - - return $this; - } - - /** - * Gets mainTempoQpm - * - * @return int - */ - public function getMainTempoQpm() - { - return $this->container['mainTempoQpm']; - } - - /** - * Sets mainTempoQpm - * - * @param int $mainTempoQpm The main tempo of the score (in QPM) - * - * @return $this - */ - public function setMainTempoQpm($mainTempoQpm) - { - $this->container['mainTempoQpm'] = $mainTempoQpm; - - return $this; - } - - /** - * Gets rights - * - * @return \Flat\APIClient\Model\ResourceRights - */ - public function getRights() - { - return $this->container['rights']; - } - - /** - * Sets rights - * - * @param \Flat\APIClient\Model\ResourceRights $rights rights - * - * @return $this - */ - public function setRights($rights) - { - $this->container['rights'] = $rights; - - return $this; - } - - /** - * Gets collaborators - * - * @return \Flat\APIClient\Model\ResourceCollaborator[] - */ - public function getCollaborators() - { - return $this->container['collaborators']; - } - - /** - * Sets collaborators - * - * @param \Flat\APIClient\Model\ResourceCollaborator[] $collaborators The list of the collaborators of the score - * - * @return $this - */ - public function setCollaborators($collaborators) - { - $this->container['collaborators'] = $collaborators; - - return $this; - } - - /** - * Gets creationDate - * - * @return \DateTime - */ - public function getCreationDate() - { - return $this->container['creationDate']; - } - - /** - * Sets creationDate - * - * @param \DateTime $creationDate The date when the score was created - * - * @return $this - */ - public function setCreationDate($creationDate) - { - $this->container['creationDate'] = $creationDate; - - return $this; - } - - /** - * Gets modificationDate - * - * @return \DateTime - */ - public function getModificationDate() - { - return $this->container['modificationDate']; - } - - /** - * Sets modificationDate - * - * @param \DateTime $modificationDate The date of the last revision of the score - * - * @return $this - */ - public function setModificationDate($modificationDate) - { - $this->container['modificationDate'] = $modificationDate; - - return $this; - } - - /** - * Gets publicationDate - * - * @return \DateTime - */ - public function getPublicationDate() - { - return $this->container['publicationDate']; - } - - /** - * Sets publicationDate - * - * @param \DateTime $publicationDate The date when the score was published on Flat - * - * @return $this - */ - public function setPublicationDate($publicationDate) - { - $this->container['publicationDate'] = $publicationDate; - - return $this; - } - - /** - * Gets organization - * - * @return string - */ - public function getOrganization() - { - return $this->container['organization']; - } - - /** - * Sets organization - * - * @param string $organization If the score has been created in an organization, the identifier of this organization. This property is especially used with the score privacy `organizationPublic`. - * - * @return $this - */ - public function setOrganization($organization) - { - $this->container['organization'] = $organization; - - return $this; - } - - /** - * Gets parentScore - * - * @return string - */ - public function getParentScore() - { - return $this->container['parentScore']; - } - - /** - * Sets parentScore - * - * @param string $parentScore If the score has been forked, the unique identifier of the parent score. - * - * @return $this - */ - public function setParentScore($parentScore) - { - $this->container['parentScore'] = $parentScore; - - return $this; - } - - /** - * Gets instruments - * - * @return string[] - */ - public function getInstruments() - { - return $this->container['instruments']; - } - - /** - * Sets instruments - * - * @param string[] $instruments An array of the instrument identifiers used in the last version of the score. This is mainly used to display a list of the instruments in the Flat's UI or instruments icons. The format of the strings is `{instrument-group}.{instrument-id}`. - * - * @return $this - */ - public function setInstruments($instruments) - { - $this->container['instruments'] = $instruments; - - return $this; - } - - /** - * Gets googleDriveFileId - * - * @return string - */ - public function getGoogleDriveFileId() - { - return $this->container['googleDriveFileId']; - } - - /** - * Sets googleDriveFileId - * - * @param string $googleDriveFileId If the user uses Google Drive and the score exists on Google Drive, this field will contain the unique identifier of the Flat score on Google Drive. You can access the document using the url: `https://drive.google.com/open?id={googleDriveFileId}` - * - * @return $this - */ - public function setGoogleDriveFileId($googleDriveFileId) - { - $this->container['googleDriveFileId'] = $googleDriveFileId; - - return $this; - } - - /** - * Gets likes - * - * @return \Flat\APIClient\Model\ScoreLikesCounts - */ - public function getLikes() - { - return $this->container['likes']; - } - - /** - * Sets likes - * - * @param \Flat\APIClient\Model\ScoreLikesCounts $likes likes - * - * @return $this - */ - public function setLikes($likes) - { - $this->container['likes'] = $likes; - - return $this; - } - - /** - * Gets comments - * - * @return \Flat\APIClient\Model\ScoreCommentsCounts - */ - public function getComments() - { - return $this->container['comments']; - } - - /** - * Sets comments - * - * @param \Flat\APIClient\Model\ScoreCommentsCounts $comments comments - * - * @return $this - */ - public function setComments($comments) - { - $this->container['comments'] = $comments; - - return $this; - } - - /** - * Gets views - * - * @return \Flat\APIClient\Model\ScoreViewsCounts - */ - public function getViews() - { - return $this->container['views']; - } - - /** - * Sets views - * - * @param \Flat\APIClient\Model\ScoreViewsCounts $views views - * - * @return $this - */ - public function setViews($views) - { - $this->container['views'] = $views; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ScoreFork.php b/lib/Model/ScoreFork.php deleted file mode 100644 index 2f024c7..0000000 --- a/lib/Model/ScoreFork.php +++ /dev/null @@ -1,302 +0,0 @@ - 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'collection' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'collection' => 'collection' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'collection' => 'setCollection' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'collection' => 'getCollection' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['collection'] = isset($data['collection']) ? $data['collection'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets collection - * - * @return string - */ - public function getCollection() - { - return $this->container['collection']; - } - - /** - * Sets collection - * - * @param string $collection Unique identifier of a collection where the score will be copied. If no collection identifier is provided, the score will be stored in the `root` directory. - * - * @return $this - */ - public function setCollection($collection) - { - $this->container['collection'] = $collection; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ScoreLicense.php b/lib/Model/ScoreLicense.php deleted file mode 100644 index 9d4f886..0000000 --- a/lib/Model/ScoreLicense.php +++ /dev/null @@ -1,75 +0,0 @@ - 'float', - 'weekly' => 'float', - 'monthly' => 'float' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'total' => null, - 'weekly' => null, - 'monthly' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'total' => 'total', - 'weekly' => 'weekly', - 'monthly' => 'monthly' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'total' => 'setTotal', - 'weekly' => 'setWeekly', - 'monthly' => 'setMonthly' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'total' => 'getTotal', - 'weekly' => 'getWeekly', - 'monthly' => 'getMonthly' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['total'] = isset($data['total']) ? $data['total'] : null; - $this->container['weekly'] = isset($data['weekly']) ? $data['weekly'] : null; - $this->container['monthly'] = isset($data['monthly']) ? $data['monthly'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets total - * - * @return float - */ - public function getTotal() - { - return $this->container['total']; - } - - /** - * Sets total - * - * @param float $total The total number of likes of the score - * - * @return $this - */ - public function setTotal($total) - { - $this->container['total'] = $total; - - return $this; - } - - /** - * Gets weekly - * - * @return float - */ - public function getWeekly() - { - return $this->container['weekly']; - } - - /** - * Sets weekly - * - * @param float $weekly The number of new likes during the last week - * - * @return $this - */ - public function setWeekly($weekly) - { - $this->container['weekly'] = $weekly; - - return $this; - } - - /** - * Gets monthly - * - * @return float - */ - public function getMonthly() - { - return $this->container['monthly']; - } - - /** - * Sets monthly - * - * @param float $monthly The number of new likes during the last month - * - * @return $this - */ - public function setMonthly($monthly) - { - $this->container['monthly'] = $monthly; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ScoreModification.php b/lib/Model/ScoreModification.php deleted file mode 100644 index 4fc9de8..0000000 --- a/lib/Model/ScoreModification.php +++ /dev/null @@ -1,490 +0,0 @@ - 'string', - 'privacy' => '\Flat\APIClient\Model\ScorePrivacy', - 'sharingKey' => '\Flat\APIClient\Model\ResourceSharingKey', - 'description' => 'string', - 'tags' => 'string[]', - 'creationType' => '\Flat\APIClient\Model\ScoreCreationType', - 'license' => '\Flat\APIClient\Model\ScoreLicense' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'title' => null, - 'privacy' => null, - 'sharingKey' => null, - 'description' => null, - 'tags' => null, - 'creationType' => null, - 'license' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'title' => 'title', - 'privacy' => 'privacy', - 'sharingKey' => 'sharingKey', - 'description' => 'description', - 'tags' => 'tags', - 'creationType' => 'creationType', - 'license' => 'license' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'title' => 'setTitle', - 'privacy' => 'setPrivacy', - 'sharingKey' => 'setSharingKey', - 'description' => 'setDescription', - 'tags' => 'setTags', - 'creationType' => 'setCreationType', - 'license' => 'setLicense' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'title' => 'getTitle', - 'privacy' => 'getPrivacy', - 'sharingKey' => 'getSharingKey', - 'description' => 'getDescription', - 'tags' => 'getTags', - 'creationType' => 'getCreationType', - 'license' => 'getLicense' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['title'] = isset($data['title']) ? $data['title'] : null; - $this->container['privacy'] = isset($data['privacy']) ? $data['privacy'] : null; - $this->container['sharingKey'] = isset($data['sharingKey']) ? $data['sharingKey'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; - $this->container['tags'] = isset($data['tags']) ? $data['tags'] : null; - $this->container['creationType'] = isset($data['creationType']) ? $data['creationType'] : null; - $this->container['license'] = isset($data['license']) ? $data['license'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if (!is_null($this->container['description']) && (mb_strlen($this->container['description']) > 1000)) { - $invalidProperties[] = "invalid value for 'description', the character length must be smaller than or equal to 1000."; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets title - * - * @return string - */ - public function getTitle() - { - return $this->container['title']; - } - - /** - * Sets title - * - * @param string $title The title of the score - * - * @return $this - */ - public function setTitle($title) - { - $this->container['title'] = $title; - - return $this; - } - - /** - * Gets privacy - * - * @return \Flat\APIClient\Model\ScorePrivacy - */ - public function getPrivacy() - { - return $this->container['privacy']; - } - - /** - * Sets privacy - * - * @param \Flat\APIClient\Model\ScorePrivacy $privacy privacy - * - * @return $this - */ - public function setPrivacy($privacy) - { - $this->container['privacy'] = $privacy; - - return $this; - } - - /** - * Gets sharingKey - * - * @return \Flat\APIClient\Model\ResourceSharingKey - */ - public function getSharingKey() - { - return $this->container['sharingKey']; - } - - /** - * Sets sharingKey - * - * @param \Flat\APIClient\Model\ResourceSharingKey $sharingKey sharingKey - * - * @return $this - */ - public function setSharingKey($sharingKey) - { - $this->container['sharingKey'] = $sharingKey; - - return $this; - } - - /** - * Gets description - * - * @return string - */ - public function getDescription() - { - return $this->container['description']; - } - - /** - * Sets description - * - * @param string $description Description of the creation - * - * @return $this - */ - public function setDescription($description) - { - if (!is_null($description) && (mb_strlen($description) > 1000)) { - throw new \InvalidArgumentException('invalid length for $description when calling ScoreModification., must be smaller than or equal to 1000.'); - } - - $this->container['description'] = $description; - - return $this; - } - - /** - * Gets tags - * - * @return string[] - */ - public function getTags() - { - return $this->container['tags']; - } - - /** - * Sets tags - * - * @param string[] $tags Tags describing the score - * - * @return $this - */ - public function setTags($tags) - { - $this->container['tags'] = $tags; - - return $this; - } - - /** - * Gets creationType - * - * @return \Flat\APIClient\Model\ScoreCreationType - */ - public function getCreationType() - { - return $this->container['creationType']; - } - - /** - * Sets creationType - * - * @param \Flat\APIClient\Model\ScoreCreationType $creationType creationType - * - * @return $this - */ - public function setCreationType($creationType) - { - $this->container['creationType'] = $creationType; - - return $this; - } - - /** - * Gets license - * - * @return \Flat\APIClient\Model\ScoreLicense - */ - public function getLicense() - { - return $this->container['license']; - } - - /** - * Sets license - * - * @param \Flat\APIClient\Model\ScoreLicense $license license - * - * @return $this - */ - public function setLicense($license) - { - $this->container['license'] = $license; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ScorePrivacy.php b/lib/Model/ScorePrivacy.php deleted file mode 100644 index 2ce5ac4..0000000 --- a/lib/Model/ScorePrivacy.php +++ /dev/null @@ -1,67 +0,0 @@ - 'string', - 'user' => 'string', - 'collaborators' => 'string[]', - 'creationDate' => '\DateTime', - 'description' => 'string', - 'autosave' => 'bool', - 'statistics' => '\Flat\APIClient\Model\ScoreRevisionStatistics' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null, - 'user' => null, - 'collaborators' => null, - 'creationDate' => 'date-time', - 'description' => null, - 'autosave' => null, - 'statistics' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'user' => 'user', - 'collaborators' => 'collaborators', - 'creationDate' => 'creationDate', - 'description' => 'description', - 'autosave' => 'autosave', - 'statistics' => 'statistics' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'user' => 'setUser', - 'collaborators' => 'setCollaborators', - 'creationDate' => 'setCreationDate', - 'description' => 'setDescription', - 'autosave' => 'setAutosave', - 'statistics' => 'setStatistics' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'user' => 'getUser', - 'collaborators' => 'getCollaborators', - 'creationDate' => 'getCreationDate', - 'description' => 'getDescription', - 'autosave' => 'getAutosave', - 'statistics' => 'getStatistics' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['user'] = isset($data['user']) ? $data['user'] : null; - $this->container['collaborators'] = isset($data['collaborators']) ? $data['collaborators'] : null; - $this->container['creationDate'] = isset($data['creationDate']) ? $data['creationDate'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; - $this->container['autosave'] = isset($data['autosave']) ? $data['autosave'] : null; - $this->container['statistics'] = isset($data['statistics']) ? $data['statistics'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id The unique identifier of the revision. - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets user - * - * @return string - */ - public function getUser() - { - return $this->container['user']; - } - - /** - * Sets user - * - * @param string $user The user identifier who created the revision - * - * @return $this - */ - public function setUser($user) - { - $this->container['user'] = $user; - - return $this; - } - - /** - * Gets collaborators - * - * @return string[] - */ - public function getCollaborators() - { - return $this->container['collaborators']; - } - - /** - * Sets collaborators - * - * @param string[] $collaborators collaborators - * - * @return $this - */ - public function setCollaborators($collaborators) - { - $this->container['collaborators'] = $collaborators; - - return $this; - } - - /** - * Gets creationDate - * - * @return \DateTime - */ - public function getCreationDate() - { - return $this->container['creationDate']; - } - - /** - * Sets creationDate - * - * @param \DateTime $creationDate The date when this revision was created - * - * @return $this - */ - public function setCreationDate($creationDate) - { - $this->container['creationDate'] = $creationDate; - - return $this; - } - - /** - * Gets description - * - * @return string - */ - public function getDescription() - { - return $this->container['description']; - } - - /** - * Sets description - * - * @param string $description A description associated to the revision - * - * @return $this - */ - public function setDescription($description) - { - $this->container['description'] = $description; - - return $this; - } - - /** - * Gets autosave - * - * @return bool - */ - public function getAutosave() - { - return $this->container['autosave']; - } - - /** - * Sets autosave - * - * @param bool $autosave True if this revision was automatically generated by Flat and not on purpose by the user. - * - * @return $this - */ - public function setAutosave($autosave) - { - $this->container['autosave'] = $autosave; - - return $this; - } - - /** - * Gets statistics - * - * @return \Flat\APIClient\Model\ScoreRevisionStatistics - */ - public function getStatistics() - { - return $this->container['statistics']; - } - - /** - * Sets statistics - * - * @param \Flat\APIClient\Model\ScoreRevisionStatistics $statistics statistics - * - * @return $this - */ - public function setStatistics($statistics) - { - $this->container['statistics'] = $statistics; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ScoreRevisionCreation.php b/lib/Model/ScoreRevisionCreation.php deleted file mode 100644 index 6790101..0000000 --- a/lib/Model/ScoreRevisionCreation.php +++ /dev/null @@ -1,395 +0,0 @@ - '\Flat\APIClient\Model\ScoreData', - 'dataEncoding' => '\Flat\APIClient\Model\ScoreDataEncoding', - 'autosave' => 'bool', - 'description' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'data' => null, - 'dataEncoding' => null, - 'autosave' => null, - 'description' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'data' => 'data', - 'dataEncoding' => 'dataEncoding', - 'autosave' => 'autosave', - 'description' => 'description' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'data' => 'setData', - 'dataEncoding' => 'setDataEncoding', - 'autosave' => 'setAutosave', - 'description' => 'setDescription' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'data' => 'getData', - 'dataEncoding' => 'getDataEncoding', - 'autosave' => 'getAutosave', - 'description' => 'getDescription' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['data'] = isset($data['data']) ? $data['data'] : null; - $this->container['dataEncoding'] = isset($data['dataEncoding']) ? $data['dataEncoding'] : null; - $this->container['autosave'] = isset($data['autosave']) ? $data['autosave'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['data'] === null) { - $invalidProperties[] = "'data' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets data - * - * @return \Flat\APIClient\Model\ScoreData - */ - public function getData() - { - return $this->container['data']; - } - - /** - * Sets data - * - * @param \Flat\APIClient\Model\ScoreData $data data - * - * @return $this - */ - public function setData($data) - { - $this->container['data'] = $data; - - return $this; - } - - /** - * Gets dataEncoding - * - * @return \Flat\APIClient\Model\ScoreDataEncoding - */ - public function getDataEncoding() - { - return $this->container['dataEncoding']; - } - - /** - * Sets dataEncoding - * - * @param \Flat\APIClient\Model\ScoreDataEncoding $dataEncoding dataEncoding - * - * @return $this - */ - public function setDataEncoding($dataEncoding) - { - $this->container['dataEncoding'] = $dataEncoding; - - return $this; - } - - /** - * Gets autosave - * - * @return bool - */ - public function getAutosave() - { - return $this->container['autosave']; - } - - /** - * Sets autosave - * - * @param bool $autosave Must be set to `true` if the revision was created automatically. - * - * @return $this - */ - public function setAutosave($autosave) - { - $this->container['autosave'] = $autosave; - - return $this; - } - - /** - * Gets description - * - * @return string - */ - public function getDescription() - { - return $this->container['description']; - } - - /** - * Sets description - * - * @param string $description A description associated to the revision - * - * @return $this - */ - public function setDescription($description) - { - $this->container['description'] = $description; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ScoreRevisionStatistics.php b/lib/Model/ScoreRevisionStatistics.php deleted file mode 100644 index ab28f94..0000000 --- a/lib/Model/ScoreRevisionStatistics.php +++ /dev/null @@ -1,332 +0,0 @@ - 'float', - 'deletions' => 'float' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'additions' => null, - 'deletions' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'additions' => 'additions', - 'deletions' => 'deletions' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'additions' => 'setAdditions', - 'deletions' => 'setDeletions' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'additions' => 'getAdditions', - 'deletions' => 'getDeletions' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['additions'] = isset($data['additions']) ? $data['additions'] : null; - $this->container['deletions'] = isset($data['deletions']) ? $data['deletions'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets additions - * - * @return float - */ - public function getAdditions() - { - return $this->container['additions']; - } - - /** - * Sets additions - * - * @param float $additions The number of additions operations in the last revision - * - * @return $this - */ - public function setAdditions($additions) - { - $this->container['additions'] = $additions; - - return $this; - } - - /** - * Gets deletions - * - * @return float - */ - public function getDeletions() - { - return $this->container['deletions']; - } - - /** - * Sets deletions - * - * @param float $deletions The number of deletions operations in the last revision - * - * @return $this - */ - public function setDeletions($deletions) - { - $this->container['deletions'] = $deletions; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ScoreSource.php b/lib/Model/ScoreSource.php deleted file mode 100644 index f43452e..0000000 --- a/lib/Model/ScoreSource.php +++ /dev/null @@ -1,301 +0,0 @@ - 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'googleDrive' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'googleDrive' => 'googleDrive' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'googleDrive' => 'setGoogleDrive' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'googleDrive' => 'getGoogleDrive' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['googleDrive'] = isset($data['googleDrive']) ? $data['googleDrive'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets googleDrive - * - * @return string - */ - public function getGoogleDrive() - { - return $this->container['googleDrive']; - } - - /** - * Sets googleDrive - * - * @param string $googleDrive If the score is a file on Google Drive, this field property must contain its identifier. To use this method, the Drive file must be public or the Flat Drive App must have access to the file. - * - * @return $this - */ - public function setGoogleDrive($googleDrive) - { - $this->container['googleDrive'] = $googleDrive; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ScoreSummary.php b/lib/Model/ScoreSummary.php deleted file mode 100644 index 03c10a8..0000000 --- a/lib/Model/ScoreSummary.php +++ /dev/null @@ -1,452 +0,0 @@ - 'string', - 'sharingKey' => 'string', - 'title' => 'string', - 'privacy' => '\Flat\APIClient\Model\ScorePrivacy', - 'user' => '\Flat\APIClient\Model\UserPublicSummary', - 'htmlUrl' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null, - 'sharingKey' => null, - 'title' => null, - 'privacy' => null, - 'user' => null, - 'htmlUrl' => 'url' - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'sharingKey' => 'sharingKey', - 'title' => 'title', - 'privacy' => 'privacy', - 'user' => 'user', - 'htmlUrl' => 'htmlUrl' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'sharingKey' => 'setSharingKey', - 'title' => 'setTitle', - 'privacy' => 'setPrivacy', - 'user' => 'setUser', - 'htmlUrl' => 'setHtmlUrl' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'sharingKey' => 'getSharingKey', - 'title' => 'getTitle', - 'privacy' => 'getPrivacy', - 'user' => 'getUser', - 'htmlUrl' => 'getHtmlUrl' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['sharingKey'] = isset($data['sharingKey']) ? $data['sharingKey'] : null; - $this->container['title'] = isset($data['title']) ? $data['title'] : null; - $this->container['privacy'] = isset($data['privacy']) ? $data['privacy'] : null; - $this->container['user'] = isset($data['user']) ? $data['user'] : null; - $this->container['htmlUrl'] = isset($data['htmlUrl']) ? $data['htmlUrl'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id The unique identifier of the score - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets sharingKey - * - * @return string - */ - public function getSharingKey() - { - return $this->container['sharingKey']; - } - - /** - * Sets sharingKey - * - * @param string $sharingKey The private sharing key of the score (available when the `privacy` mode is set to `privateLink`) - * - * @return $this - */ - public function setSharingKey($sharingKey) - { - $this->container['sharingKey'] = $sharingKey; - - return $this; - } - - /** - * Gets title - * - * @return string - */ - public function getTitle() - { - return $this->container['title']; - } - - /** - * Sets title - * - * @param string $title The title of the score - * - * @return $this - */ - public function setTitle($title) - { - $this->container['title'] = $title; - - return $this; - } - - /** - * Gets privacy - * - * @return \Flat\APIClient\Model\ScorePrivacy - */ - public function getPrivacy() - { - return $this->container['privacy']; - } - - /** - * Sets privacy - * - * @param \Flat\APIClient\Model\ScorePrivacy $privacy privacy - * - * @return $this - */ - public function setPrivacy($privacy) - { - $this->container['privacy'] = $privacy; - - return $this; - } - - /** - * Gets user - * - * @return \Flat\APIClient\Model\UserPublicSummary - */ - public function getUser() - { - return $this->container['user']; - } - - /** - * Sets user - * - * @param \Flat\APIClient\Model\UserPublicSummary $user user - * - * @return $this - */ - public function setUser($user) - { - $this->container['user'] = $user; - - return $this; - } - - /** - * Gets htmlUrl - * - * @return string - */ - public function getHtmlUrl() - { - return $this->container['htmlUrl']; - } - - /** - * Sets htmlUrl - * - * @param string $htmlUrl The url where the score can be viewed in a web browser - * - * @return $this - */ - public function setHtmlUrl($htmlUrl) - { - $this->container['htmlUrl'] = $htmlUrl; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ScoreTrack.php b/lib/Model/ScoreTrack.php deleted file mode 100644 index fa9c113..0000000 --- a/lib/Model/ScoreTrack.php +++ /dev/null @@ -1,632 +0,0 @@ - 'string', - 'title' => 'string', - 'score' => 'string', - 'creator' => 'string', - 'creationDate' => '\DateTime', - 'modificationDate' => '\DateTime', - 'default' => 'bool', - 'state' => '\Flat\APIClient\Model\ScoreTrackState', - 'type' => '\Flat\APIClient\Model\ScoreTrackType', - 'url' => 'string', - 'mediaId' => 'string', - 'synchronizationPoints' => '\Flat\APIClient\Model\ScoreTrackPoint[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null, - 'title' => null, - 'score' => null, - 'creator' => null, - 'creationDate' => 'date-time', - 'modificationDate' => 'date-time', - 'default' => null, - 'state' => null, - 'type' => null, - 'url' => null, - 'mediaId' => null, - 'synchronizationPoints' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'title' => 'title', - 'score' => 'score', - 'creator' => 'creator', - 'creationDate' => 'creationDate', - 'modificationDate' => 'modificationDate', - 'default' => 'default', - 'state' => 'state', - 'type' => 'type', - 'url' => 'url', - 'mediaId' => 'mediaId', - 'synchronizationPoints' => 'synchronizationPoints' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'title' => 'setTitle', - 'score' => 'setScore', - 'creator' => 'setCreator', - 'creationDate' => 'setCreationDate', - 'modificationDate' => 'setModificationDate', - 'default' => 'setDefault', - 'state' => 'setState', - 'type' => 'setType', - 'url' => 'setUrl', - 'mediaId' => 'setMediaId', - 'synchronizationPoints' => 'setSynchronizationPoints' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'title' => 'getTitle', - 'score' => 'getScore', - 'creator' => 'getCreator', - 'creationDate' => 'getCreationDate', - 'modificationDate' => 'getModificationDate', - 'default' => 'getDefault', - 'state' => 'getState', - 'type' => 'getType', - 'url' => 'getUrl', - 'mediaId' => 'getMediaId', - 'synchronizationPoints' => 'getSynchronizationPoints' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['title'] = isset($data['title']) ? $data['title'] : null; - $this->container['score'] = isset($data['score']) ? $data['score'] : null; - $this->container['creator'] = isset($data['creator']) ? $data['creator'] : null; - $this->container['creationDate'] = isset($data['creationDate']) ? $data['creationDate'] : null; - $this->container['modificationDate'] = isset($data['modificationDate']) ? $data['modificationDate'] : null; - $this->container['default'] = isset($data['default']) ? $data['default'] : null; - $this->container['state'] = isset($data['state']) ? $data['state'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - $this->container['mediaId'] = isset($data['mediaId']) ? $data['mediaId'] : null; - $this->container['synchronizationPoints'] = isset($data['synchronizationPoints']) ? $data['synchronizationPoints'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id The unique identifier of the score track - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets title - * - * @return string - */ - public function getTitle() - { - return $this->container['title']; - } - - /** - * Sets title - * - * @param string $title Title of the track - * - * @return $this - */ - public function setTitle($title) - { - $this->container['title'] = $title; - - return $this; - } - - /** - * Gets score - * - * @return string - */ - public function getScore() - { - return $this->container['score']; - } - - /** - * Sets score - * - * @param string $score The unique identifier of the score - * - * @return $this - */ - public function setScore($score) - { - $this->container['score'] = $score; - - return $this; - } - - /** - * Gets creator - * - * @return string - */ - public function getCreator() - { - return $this->container['creator']; - } - - /** - * Sets creator - * - * @param string $creator The unique identifier of the track creator - * - * @return $this - */ - public function setCreator($creator) - { - $this->container['creator'] = $creator; - - return $this; - } - - /** - * Gets creationDate - * - * @return \DateTime - */ - public function getCreationDate() - { - return $this->container['creationDate']; - } - - /** - * Sets creationDate - * - * @param \DateTime $creationDate The creation date of the track - * - * @return $this - */ - public function setCreationDate($creationDate) - { - $this->container['creationDate'] = $creationDate; - - return $this; - } - - /** - * Gets modificationDate - * - * @return \DateTime - */ - public function getModificationDate() - { - return $this->container['modificationDate']; - } - - /** - * Sets modificationDate - * - * @param \DateTime $modificationDate The modification date of the track - * - * @return $this - */ - public function setModificationDate($modificationDate) - { - $this->container['modificationDate'] = $modificationDate; - - return $this; - } - - /** - * Gets default - * - * @return bool - */ - public function getDefault() - { - return $this->container['default']; - } - - /** - * Sets default - * - * @param bool $default True if the track should be used as default audio source - * - * @return $this - */ - public function setDefault($default) - { - $this->container['default'] = $default; - - return $this; - } - - /** - * Gets state - * - * @return \Flat\APIClient\Model\ScoreTrackState - */ - public function getState() - { - return $this->container['state']; - } - - /** - * Sets state - * - * @param \Flat\APIClient\Model\ScoreTrackState $state state - * - * @return $this - */ - public function setState($state) - { - $this->container['state'] = $state; - - return $this; - } - - /** - * Gets type - * - * @return \Flat\APIClient\Model\ScoreTrackType - */ - public function getType() - { - return $this->container['type']; - } - - /** - * Sets type - * - * @param \Flat\APIClient\Model\ScoreTrackType $type type - * - * @return $this - */ - public function setType($type) - { - $this->container['type'] = $type; - - return $this; - } - - /** - * Gets url - * - * @return string - */ - public function getUrl() - { - return $this->container['url']; - } - - /** - * Sets url - * - * @param string $url The URL of the track - * - * @return $this - */ - public function setUrl($url) - { - $this->container['url'] = $url; - - return $this; - } - - /** - * Gets mediaId - * - * @return string - */ - public function getMediaId() - { - return $this->container['mediaId']; - } - - /** - * Sets mediaId - * - * @param string $mediaId The unique identifier of the track when hosted on an external service. For example, if the url is `https://www.youtube.com/watch?v=dQw4w9WgXcQ`, `mediaId` will be `dQw4w9WgXcQ` - * - * @return $this - */ - public function setMediaId($mediaId) - { - $this->container['mediaId'] = $mediaId; - - return $this; - } - - /** - * Gets synchronizationPoints - * - * @return \Flat\APIClient\Model\ScoreTrackPoint[] - */ - public function getSynchronizationPoints() - { - return $this->container['synchronizationPoints']; - } - - /** - * Sets synchronizationPoints - * - * @param \Flat\APIClient\Model\ScoreTrackPoint[] $synchronizationPoints synchronizationPoints - * - * @return $this - */ - public function setSynchronizationPoints($synchronizationPoints) - { - $this->container['synchronizationPoints'] = $synchronizationPoints; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ScoreTrackCreation.php b/lib/Model/ScoreTrackCreation.php deleted file mode 100644 index b5b35da..0000000 --- a/lib/Model/ScoreTrackCreation.php +++ /dev/null @@ -1,422 +0,0 @@ - 'string', - 'default' => 'bool', - 'state' => '\Flat\APIClient\Model\ScoreTrackState', - 'url' => 'string', - 'synchronizationPoints' => '\Flat\APIClient\Model\ScoreTrackPoint[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'title' => null, - 'default' => null, - 'state' => null, - 'url' => null, - 'synchronizationPoints' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'title' => 'title', - 'default' => 'default', - 'state' => 'state', - 'url' => 'url', - 'synchronizationPoints' => 'synchronizationPoints' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'title' => 'setTitle', - 'default' => 'setDefault', - 'state' => 'setState', - 'url' => 'setUrl', - 'synchronizationPoints' => 'setSynchronizationPoints' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'title' => 'getTitle', - 'default' => 'getDefault', - 'state' => 'getState', - 'url' => 'getUrl', - 'synchronizationPoints' => 'getSynchronizationPoints' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['title'] = isset($data['title']) ? $data['title'] : null; - $this->container['default'] = isset($data['default']) ? $data['default'] : null; - $this->container['state'] = isset($data['state']) ? $data['state'] : null; - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - $this->container['synchronizationPoints'] = isset($data['synchronizationPoints']) ? $data['synchronizationPoints'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets title - * - * @return string - */ - public function getTitle() - { - return $this->container['title']; - } - - /** - * Sets title - * - * @param string $title Title of the track - * - * @return $this - */ - public function setTitle($title) - { - $this->container['title'] = $title; - - return $this; - } - - /** - * Gets default - * - * @return bool - */ - public function getDefault() - { - return $this->container['default']; - } - - /** - * Sets default - * - * @param bool $default True if the track should be used as default audio source - * - * @return $this - */ - public function setDefault($default) - { - $this->container['default'] = $default; - - return $this; - } - - /** - * Gets state - * - * @return \Flat\APIClient\Model\ScoreTrackState - */ - public function getState() - { - return $this->container['state']; - } - - /** - * Sets state - * - * @param \Flat\APIClient\Model\ScoreTrackState $state state - * - * @return $this - */ - public function setState($state) - { - $this->container['state'] = $state; - - return $this; - } - - /** - * Gets url - * - * @return string - */ - public function getUrl() - { - return $this->container['url']; - } - - /** - * Sets url - * - * @param string $url The URL of the track - * - * @return $this - */ - public function setUrl($url) - { - $this->container['url'] = $url; - - return $this; - } - - /** - * Gets synchronizationPoints - * - * @return \Flat\APIClient\Model\ScoreTrackPoint[] - */ - public function getSynchronizationPoints() - { - return $this->container['synchronizationPoints']; - } - - /** - * Sets synchronizationPoints - * - * @param \Flat\APIClient\Model\ScoreTrackPoint[] $synchronizationPoints synchronizationPoints - * - * @return $this - */ - public function setSynchronizationPoints($synchronizationPoints) - { - $this->container['synchronizationPoints'] = $synchronizationPoints; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ScoreTrackPoint.php b/lib/Model/ScoreTrackPoint.php deleted file mode 100644 index cae4ec2..0000000 --- a/lib/Model/ScoreTrackPoint.php +++ /dev/null @@ -1,400 +0,0 @@ - 'string', - 'measureUuid' => 'string', - 'time' => 'float' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'type' => null, - 'measureUuid' => 'uuid', - 'time' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'type' => 'type', - 'measureUuid' => 'measureUuid', - 'time' => 'time' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'type' => 'setType', - 'measureUuid' => 'setMeasureUuid', - 'time' => 'setTime' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'type' => 'getType', - 'measureUuid' => 'getMeasureUuid', - 'time' => 'getTime' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const TYPE_MEASURE = 'measure'; - const TYPE_END = 'end'; - - - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getTypeAllowableValues() - { - return [ - self::TYPE_MEASURE, - self::TYPE_END, - ]; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['measureUuid'] = isset($data['measureUuid']) ? $data['measureUuid'] : null; - $this->container['time'] = isset($data['time']) ? $data['time'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['type'] === null) { - $invalidProperties[] = "'type' can't be null"; - } - $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value for 'type', must be one of '%s'", - implode("', '", $allowedValues) - ); - } - - if ($this->container['time'] === null) { - $invalidProperties[] = "'time' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets type - * - * @return string - */ - public function getType() - { - return $this->container['type']; - } - - /** - * Sets type - * - * @param string $type The type of the synchronization point. If the type is `measure`, the measure uuid must be present in `measureUuid` - * - * @return $this - */ - public function setType($type) - { - $allowedValues = $this->getTypeAllowableValues(); - if (!in_array($type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'type', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); - } - $this->container['type'] = $type; - - return $this; - } - - /** - * Gets measureUuid - * - * @return string - */ - public function getMeasureUuid() - { - return $this->container['measureUuid']; - } - - /** - * Sets measureUuid - * - * @param string $measureUuid The measure unique identifier - * - * @return $this - */ - public function setMeasureUuid($measureUuid) - { - $this->container['measureUuid'] = $measureUuid; - - return $this; - } - - /** - * Gets time - * - * @return float - */ - public function getTime() - { - return $this->container['time']; - } - - /** - * Sets time - * - * @param float $time The corresponding time in seconds - * - * @return $this - */ - public function setTime($time) - { - $this->container['time'] = $time; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ScoreTrackState.php b/lib/Model/ScoreTrackState.php deleted file mode 100644 index d251341..0000000 --- a/lib/Model/ScoreTrackState.php +++ /dev/null @@ -1,65 +0,0 @@ - 'string', - 'default' => 'bool', - 'state' => '\Flat\APIClient\Model\ScoreTrackState', - 'synchronizationPoints' => '\Flat\APIClient\Model\ScoreTrackPoint[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'title' => null, - 'default' => null, - 'state' => null, - 'synchronizationPoints' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'title' => 'title', - 'default' => 'default', - 'state' => 'state', - 'synchronizationPoints' => 'synchronizationPoints' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'title' => 'setTitle', - 'default' => 'setDefault', - 'state' => 'setState', - 'synchronizationPoints' => 'setSynchronizationPoints' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'title' => 'getTitle', - 'default' => 'getDefault', - 'state' => 'getState', - 'synchronizationPoints' => 'getSynchronizationPoints' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['title'] = isset($data['title']) ? $data['title'] : null; - $this->container['default'] = isset($data['default']) ? $data['default'] : null; - $this->container['state'] = isset($data['state']) ? $data['state'] : null; - $this->container['synchronizationPoints'] = isset($data['synchronizationPoints']) ? $data['synchronizationPoints'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets title - * - * @return string - */ - public function getTitle() - { - return $this->container['title']; - } - - /** - * Sets title - * - * @param string $title Title of the track - * - * @return $this - */ - public function setTitle($title) - { - $this->container['title'] = $title; - - return $this; - } - - /** - * Gets default - * - * @return bool - */ - public function getDefault() - { - return $this->container['default']; - } - - /** - * Sets default - * - * @param bool $default True if the track should be used as default audio source - * - * @return $this - */ - public function setDefault($default) - { - $this->container['default'] = $default; - - return $this; - } - - /** - * Gets state - * - * @return \Flat\APIClient\Model\ScoreTrackState - */ - public function getState() - { - return $this->container['state']; - } - - /** - * Sets state - * - * @param \Flat\APIClient\Model\ScoreTrackState $state state - * - * @return $this - */ - public function setState($state) - { - $this->container['state'] = $state; - - return $this; - } - - /** - * Gets synchronizationPoints - * - * @return \Flat\APIClient\Model\ScoreTrackPoint[] - */ - public function getSynchronizationPoints() - { - return $this->container['synchronizationPoints']; - } - - /** - * Sets synchronizationPoints - * - * @param \Flat\APIClient\Model\ScoreTrackPoint[] $synchronizationPoints synchronizationPoints - * - * @return $this - */ - public function setSynchronizationPoints($synchronizationPoints) - { - $this->container['synchronizationPoints'] = $synchronizationPoints; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ScoreViewsCounts.php b/lib/Model/ScoreViewsCounts.php deleted file mode 100644 index 4e52a76..0000000 --- a/lib/Model/ScoreViewsCounts.php +++ /dev/null @@ -1,362 +0,0 @@ - 'float', - 'weekly' => 'float', - 'monthly' => 'float' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'total' => null, - 'weekly' => null, - 'monthly' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'total' => 'total', - 'weekly' => 'weekly', - 'monthly' => 'monthly' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'total' => 'setTotal', - 'weekly' => 'setWeekly', - 'monthly' => 'setMonthly' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'total' => 'getTotal', - 'weekly' => 'getWeekly', - 'monthly' => 'getMonthly' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['total'] = isset($data['total']) ? $data['total'] : null; - $this->container['weekly'] = isset($data['weekly']) ? $data['weekly'] : null; - $this->container['monthly'] = isset($data['monthly']) ? $data['monthly'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets total - * - * @return float - */ - public function getTotal() - { - return $this->container['total']; - } - - /** - * Sets total - * - * @param float $total The total number of views of the score - * - * @return $this - */ - public function setTotal($total) - { - $this->container['total'] = $total; - - return $this; - } - - /** - * Gets weekly - * - * @return float - */ - public function getWeekly() - { - return $this->container['weekly']; - } - - /** - * Sets weekly - * - * @param float $weekly The weekly number of views of the score - * - * @return $this - */ - public function setWeekly($weekly) - { - $this->container['weekly'] = $weekly; - - return $this; - } - - /** - * Gets monthly - * - * @return float - */ - public function getMonthly() - { - return $this->container['monthly']; - } - - /** - * Sets monthly - * - * @param float $monthly The monthly number of views of the score - * - * @return $this - */ - public function setMonthly($monthly) - { - $this->container['monthly'] = $monthly; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/UserAdminUpdate.php b/lib/Model/UserAdminUpdate.php deleted file mode 100644 index 160c5f6..0000000 --- a/lib/Model/UserAdminUpdate.php +++ /dev/null @@ -1,341 +0,0 @@ - 'string', - 'organizationRole' => '\Flat\APIClient\Model\OrganizationRoles' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'password' => 'password', - 'organizationRole' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'password' => 'password', - 'organizationRole' => 'organizationRole' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'password' => 'setPassword', - 'organizationRole' => 'setOrganizationRole' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'password' => 'getPassword', - 'organizationRole' => 'getOrganizationRole' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['password'] = isset($data['password']) ? $data['password'] : null; - $this->container['organizationRole'] = isset($data['organizationRole']) ? $data['organizationRole'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if (!is_null($this->container['password']) && (mb_strlen($this->container['password']) < 6)) { - $invalidProperties[] = "invalid value for 'password', the character length must be bigger than or equal to 6."; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets password - * - * @return string - */ - public function getPassword() - { - return $this->container['password']; - } - - /** - * Sets password - * - * @param string $password Password of the new account - * - * @return $this - */ - public function setPassword($password) - { - - if (!is_null($password) && (mb_strlen($password) < 6)) { - throw new \InvalidArgumentException('invalid length for $password when calling UserAdminUpdate., must be bigger than or equal to 6.'); - } - - $this->container['password'] = $password; - - return $this; - } - - /** - * Gets organizationRole - * - * @return \Flat\APIClient\Model\OrganizationRoles - */ - public function getOrganizationRole() - { - return $this->container['organizationRole']; - } - - /** - * Sets organizationRole - * - * @param \Flat\APIClient\Model\OrganizationRoles $organizationRole organizationRole - * - * @return $this - */ - public function setOrganizationRole($organizationRole) - { - $this->container['organizationRole'] = $organizationRole; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/UserBasics.php b/lib/Model/UserBasics.php deleted file mode 100644 index f97bc74..0000000 --- a/lib/Model/UserBasics.php +++ /dev/null @@ -1,455 +0,0 @@ - 'string', - 'username' => 'string', - 'name' => 'string', - 'printableName' => 'string', - 'picture' => 'string', - 'isPowerUser' => 'bool' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null, - 'username' => null, - 'name' => null, - 'printableName' => null, - 'picture' => null, - 'isPowerUser' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'username' => 'username', - 'name' => 'name', - 'printableName' => 'printableName', - 'picture' => 'picture', - 'isPowerUser' => 'isPowerUser' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'username' => 'setUsername', - 'name' => 'setName', - 'printableName' => 'setPrintableName', - 'picture' => 'setPicture', - 'isPowerUser' => 'setIsPowerUser' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'username' => 'getUsername', - 'name' => 'getName', - 'printableName' => 'getPrintableName', - 'picture' => 'getPicture', - 'isPowerUser' => 'getIsPowerUser' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['username'] = isset($data['username']) ? $data['username'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['printableName'] = isset($data['printableName']) ? $data['printableName'] : null; - $this->container['picture'] = isset($data['picture']) ? $data['picture'] : null; - $this->container['isPowerUser'] = isset($data['isPowerUser']) ? $data['isPowerUser'] : null; - - // Initialize discriminator property with the model name. - $discriminator = array_search('userType', self::$attributeMap); - $this->container[$discriminator] = static::$swaggerModelName; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id The user unique identifier - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets username - * - * @return string - */ - public function getUsername() - { - return $this->container['username']; - } - - /** - * Sets username - * - * @param string $username The user name (unique for the organization) - * - * @return $this - */ - public function setUsername($username) - { - $this->container['username'] = $username; - - return $this; - } - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name A displayable name for the user - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets printableName - * - * @return string - */ - public function getPrintableName() - { - return $this->container['printableName']; - } - - /** - * Sets printableName - * - * @param string $printableName The name that can be directly printed (name or username) - * - * @return $this - */ - public function setPrintableName($printableName) - { - $this->container['printableName'] = $printableName; - - return $this; - } - - /** - * Gets picture - * - * @return string - */ - public function getPicture() - { - return $this->container['picture']; - } - - /** - * Sets picture - * - * @param string $picture User pictue - * - * @return $this - */ - public function setPicture($picture) - { - $this->container['picture'] = $picture; - - return $this; - } - - /** - * Gets isPowerUser - * - * @return bool - */ - public function getIsPowerUser() - { - return $this->container['isPowerUser']; - } - - /** - * Sets isPowerUser - * - * @param bool $isPowerUser User license status. 'True' if user is an individual Power user - * - * @return $this - */ - public function setIsPowerUser($isPowerUser) - { - $this->container['isPowerUser'] = $isPowerUser; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/UserCreation.php b/lib/Model/UserCreation.php deleted file mode 100644 index 3b135ca..0000000 --- a/lib/Model/UserCreation.php +++ /dev/null @@ -1,416 +0,0 @@ - 'string', - 'email' => 'string', - 'password' => 'string', - 'locale' => '\Flat\APIClient\Model\FlatLocales' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'username' => null, - 'email' => 'email', - 'password' => 'password', - 'locale' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'username' => 'username', - 'email' => 'email', - 'password' => 'password', - 'locale' => 'locale' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'username' => 'setUsername', - 'email' => 'setEmail', - 'password' => 'setPassword', - 'locale' => 'setLocale' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'username' => 'getUsername', - 'email' => 'getEmail', - 'password' => 'getPassword', - 'locale' => 'getLocale' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['username'] = isset($data['username']) ? $data['username'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['password'] = isset($data['password']) ? $data['password'] : null; - $this->container['locale'] = isset($data['locale']) ? $data['locale'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['username'] === null) { - $invalidProperties[] = "'username' can't be null"; - } - if (!preg_match("/^[A-Za-z0-9\\-_.]+$/", $this->container['username'])) { - $invalidProperties[] = "invalid value for 'username', must be conform to the pattern /^[A-Za-z0-9\\-_.]+$/."; - } - - if ($this->container['password'] === null) { - $invalidProperties[] = "'password' can't be null"; - } - if ((mb_strlen($this->container['password']) < 6)) { - $invalidProperties[] = "invalid value for 'password', the character length must be bigger than or equal to 6."; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets username - * - * @return string - */ - public function getUsername() - { - return $this->container['username']; - } - - /** - * Sets username - * - * @param string $username Username of the new account - * - * @return $this - */ - public function setUsername($username) - { - - if ((!preg_match("/^[A-Za-z0-9\\-_.]+$/", $username))) { - throw new \InvalidArgumentException("invalid value for $username when calling UserCreation., must conform to the pattern /^[A-Za-z0-9\\-_.]+$/."); - } - - $this->container['username'] = $username; - - return $this; - } - - /** - * Gets email - * - * @return string - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param string $email Email of the new account - * - * @return $this - */ - public function setEmail($email) - { - $this->container['email'] = $email; - - return $this; - } - - /** - * Gets password - * - * @return string - */ - public function getPassword() - { - return $this->container['password']; - } - - /** - * Sets password - * - * @param string $password Password of the new account - * - * @return $this - */ - public function setPassword($password) - { - - if ((mb_strlen($password) < 6)) { - throw new \InvalidArgumentException('invalid length for $password when calling UserCreation., must be bigger than or equal to 6.'); - } - - $this->container['password'] = $password; - - return $this; - } - - /** - * Gets locale - * - * @return \Flat\APIClient\Model\FlatLocales - */ - public function getLocale() - { - return $this->container['locale']; - } - - /** - * Sets locale - * - * @param \Flat\APIClient\Model\FlatLocales $locale locale - * - * @return $this - */ - public function setLocale($locale) - { - $this->container['locale'] = $locale; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/UserDetails.php b/lib/Model/UserDetails.php deleted file mode 100644 index eeda9c9..0000000 --- a/lib/Model/UserDetails.php +++ /dev/null @@ -1,418 +0,0 @@ - 'string', - 'type' => 'string', - 'privateProfile' => 'bool', - 'locale' => '\Flat\APIClient\Model\FlatLocales' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null, - 'type' => null, - 'privateProfile' => null, - 'locale' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes + parent::swaggerTypes(); - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats + parent::swaggerFormats(); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'type' => 'type', - 'privateProfile' => 'privateProfile', - 'locale' => 'locale' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'type' => 'setType', - 'privateProfile' => 'setPrivateProfile', - 'locale' => 'setLocale' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'type' => 'getType', - 'privateProfile' => 'getPrivateProfile', - 'locale' => 'getLocale' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return parent::attributeMap() + self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return parent::setters() + self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return parent::getters() + self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - const TYPE_USER = 'user'; - const TYPE_GUEST = 'guest'; - - - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getTypeAllowableValues() - { - return [ - self::TYPE_USER, - self::TYPE_GUEST, - ]; - } - - - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - parent::__construct($data); - - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['privateProfile'] = isset($data['privateProfile']) ? $data['privateProfile'] : null; - $this->container['locale'] = isset($data['locale']) ? $data['locale'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = parent::listInvalidProperties(); - - $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value for 'type', must be one of '%s'", - implode("', '", $allowedValues) - ); - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id Identifier of the user - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets type - * - * @return string - */ - public function getType() - { - return $this->container['type']; - } - - /** - * Sets type - * - * @param string $type The type of account - * - * @return $this - */ - public function setType($type) - { - $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($type) && !in_array($type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'type', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); - } - $this->container['type'] = $type; - - return $this; - } - - /** - * Gets privateProfile - * - * @return bool - */ - public function getPrivateProfile() - { - return $this->container['privateProfile']; - } - - /** - * Sets privateProfile - * - * @param bool $privateProfile Tell either this user profile is private or not (individual accounts only) - * - * @return $this - */ - public function setPrivateProfile($privateProfile) - { - $this->container['privateProfile'] = $privateProfile; - - return $this; - } - - /** - * Gets locale - * - * @return \Flat\APIClient\Model\FlatLocales - */ - public function getLocale() - { - return $this->container['locale']; - } - - /** - * Sets locale - * - * @param \Flat\APIClient\Model\FlatLocales $locale locale - * - * @return $this - */ - public function setLocale($locale) - { - $this->container['locale'] = $locale; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/UserDetailsAdmin.php b/lib/Model/UserDetailsAdmin.php deleted file mode 100644 index ffad00d..0000000 --- a/lib/Model/UserDetailsAdmin.php +++ /dev/null @@ -1,356 +0,0 @@ - 'string', - 'lastActivityDate' => '\DateTime', - 'license' => '\Flat\APIClient\Model\UserDetailsAdminLicense' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'email' => 'email', - 'lastActivityDate' => 'date-time', - 'license' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes + parent::swaggerTypes(); - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats + parent::swaggerFormats(); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'email' => 'email', - 'lastActivityDate' => 'lastActivityDate', - 'license' => 'license' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'email' => 'setEmail', - 'lastActivityDate' => 'setLastActivityDate', - 'license' => 'setLicense' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'email' => 'getEmail', - 'lastActivityDate' => 'getLastActivityDate', - 'license' => 'getLicense' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return parent::attributeMap() + self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return parent::setters() + self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return parent::getters() + self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - parent::__construct($data); - - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['lastActivityDate'] = isset($data['lastActivityDate']) ? $data['lastActivityDate'] : null; - $this->container['license'] = isset($data['license']) ? $data['license'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = parent::listInvalidProperties(); - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets email - * - * @return string - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param string $email Email of the user - * - * @return $this - */ - public function setEmail($email) - { - $this->container['email'] = $email; - - return $this; - } - - /** - * Gets lastActivityDate - * - * @return \DateTime - */ - public function getLastActivityDate() - { - return $this->container['lastActivityDate']; - } - - /** - * Sets lastActivityDate - * - * @param \DateTime $lastActivityDate Date of the last user activity - * - * @return $this - */ - public function setLastActivityDate($lastActivityDate) - { - $this->container['lastActivityDate'] = $lastActivityDate; - - return $this; - } - - /** - * Gets license - * - * @return \Flat\APIClient\Model\UserDetailsAdminLicense - */ - public function getLicense() - { - return $this->container['license']; - } - - /** - * Sets license - * - * @param \Flat\APIClient\Model\UserDetailsAdminLicense $license license - * - * @return $this - */ - public function setLicense($license) - { - $this->container['license'] = $license; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/UserDetailsAdminLicense.php b/lib/Model/UserDetailsAdminLicense.php deleted file mode 100644 index 034829d..0000000 --- a/lib/Model/UserDetailsAdminLicense.php +++ /dev/null @@ -1,422 +0,0 @@ - 'string', - 'expirationDate' => '\DateTime', - 'source' => '\Flat\APIClient\Model\LicenseSources', - 'mode' => '\Flat\APIClient\Model\LicenseMode', - 'active' => 'bool' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'id' => null, - 'expirationDate' => 'date-time', - 'source' => null, - 'mode' => null, - 'active' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'expirationDate' => 'expirationDate', - 'source' => 'source', - 'mode' => 'mode', - 'active' => 'active' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'expirationDate' => 'setExpirationDate', - 'source' => 'setSource', - 'mode' => 'setMode', - 'active' => 'setActive' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'expirationDate' => 'getExpirationDate', - 'source' => 'getSource', - 'mode' => 'getMode', - 'active' => 'getActive' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['expirationDate'] = isset($data['expirationDate']) ? $data['expirationDate'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['mode'] = isset($data['mode']) ? $data['mode'] : null; - $this->container['active'] = isset($data['active']) ? $data['active'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id ID of the current license - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets expirationDate - * - * @return \DateTime - */ - public function getExpirationDate() - { - return $this->container['expirationDate']; - } - - /** - * Sets expirationDate - * - * @param \DateTime $expirationDate Date when the license expires - * - * @return $this - */ - public function setExpirationDate($expirationDate) - { - $this->container['expirationDate'] = $expirationDate; - - return $this; - } - - /** - * Gets source - * - * @return \Flat\APIClient\Model\LicenseSources - */ - public function getSource() - { - return $this->container['source']; - } - - /** - * Sets source - * - * @param \Flat\APIClient\Model\LicenseSources $source source - * - * @return $this - */ - public function setSource($source) - { - $this->container['source'] = $source; - - return $this; - } - - /** - * Gets mode - * - * @return \Flat\APIClient\Model\LicenseMode - */ - public function getMode() - { - return $this->container['mode']; - } - - /** - * Sets mode - * - * @param \Flat\APIClient\Model\LicenseMode $mode mode - * - * @return $this - */ - public function setMode($mode) - { - $this->container['mode'] = $mode; - - return $this; - } - - /** - * Gets active - * - * @return bool - */ - public function getActive() - { - return $this->container['active']; - } - - /** - * Sets active - * - * @param bool $active ID of the current license - * - * @return $this - */ - public function setActive($active) - { - $this->container['active'] = $active; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/UserInstruments.php b/lib/Model/UserInstruments.php deleted file mode 100644 index d33358c..0000000 --- a/lib/Model/UserInstruments.php +++ /dev/null @@ -1,277 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/UserPublic.php b/lib/Model/UserPublic.php deleted file mode 100644 index 7452ac9..0000000 --- a/lib/Model/UserPublic.php +++ /dev/null @@ -1,506 +0,0 @@ - 'string', - 'registrationDate' => '\DateTime', - 'likedScoresCount' => 'int', - 'followersCount' => 'int', - 'followingCount' => 'int', - 'ownedPublicScoresCount' => 'int', - 'profileTheme' => 'string', - 'instruments' => '\Flat\APIClient\Model\UserInstruments' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'bio' => null, - 'registrationDate' => 'date-time', - 'likedScoresCount' => null, - 'followersCount' => null, - 'followingCount' => null, - 'ownedPublicScoresCount' => null, - 'profileTheme' => null, - 'instruments' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes + parent::swaggerTypes(); - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats + parent::swaggerFormats(); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'bio' => 'bio', - 'registrationDate' => 'registrationDate', - 'likedScoresCount' => 'likedScoresCount', - 'followersCount' => 'followersCount', - 'followingCount' => 'followingCount', - 'ownedPublicScoresCount' => 'ownedPublicScoresCount', - 'profileTheme' => 'profileTheme', - 'instruments' => 'instruments' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'bio' => 'setBio', - 'registrationDate' => 'setRegistrationDate', - 'likedScoresCount' => 'setLikedScoresCount', - 'followersCount' => 'setFollowersCount', - 'followingCount' => 'setFollowingCount', - 'ownedPublicScoresCount' => 'setOwnedPublicScoresCount', - 'profileTheme' => 'setProfileTheme', - 'instruments' => 'setInstruments' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'bio' => 'getBio', - 'registrationDate' => 'getRegistrationDate', - 'likedScoresCount' => 'getLikedScoresCount', - 'followersCount' => 'getFollowersCount', - 'followingCount' => 'getFollowingCount', - 'ownedPublicScoresCount' => 'getOwnedPublicScoresCount', - 'profileTheme' => 'getProfileTheme', - 'instruments' => 'getInstruments' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return parent::attributeMap() + self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return parent::setters() + self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return parent::getters() + self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - parent::__construct($data); - - $this->container['bio'] = isset($data['bio']) ? $data['bio'] : null; - $this->container['registrationDate'] = isset($data['registrationDate']) ? $data['registrationDate'] : null; - $this->container['likedScoresCount'] = isset($data['likedScoresCount']) ? $data['likedScoresCount'] : null; - $this->container['followersCount'] = isset($data['followersCount']) ? $data['followersCount'] : null; - $this->container['followingCount'] = isset($data['followingCount']) ? $data['followingCount'] : null; - $this->container['ownedPublicScoresCount'] = isset($data['ownedPublicScoresCount']) ? $data['ownedPublicScoresCount'] : null; - $this->container['profileTheme'] = isset($data['profileTheme']) ? $data['profileTheme'] : null; - $this->container['instruments'] = isset($data['instruments']) ? $data['instruments'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = parent::listInvalidProperties(); - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets bio - * - * @return string - */ - public function getBio() - { - return $this->container['bio']; - } - - /** - * Sets bio - * - * @param string $bio User's biography - * - * @return $this - */ - public function setBio($bio) - { - $this->container['bio'] = $bio; - - return $this; - } - - /** - * Gets registrationDate - * - * @return \DateTime - */ - public function getRegistrationDate() - { - return $this->container['registrationDate']; - } - - /** - * Sets registrationDate - * - * @param \DateTime $registrationDate Date the user signed up - * - * @return $this - */ - public function setRegistrationDate($registrationDate) - { - $this->container['registrationDate'] = $registrationDate; - - return $this; - } - - /** - * Gets likedScoresCount - * - * @return int - */ - public function getLikedScoresCount() - { - return $this->container['likedScoresCount']; - } - - /** - * Sets likedScoresCount - * - * @param int $likedScoresCount Number of the scores liked by the user - * - * @return $this - */ - public function setLikedScoresCount($likedScoresCount) - { - $this->container['likedScoresCount'] = $likedScoresCount; - - return $this; - } - - /** - * Gets followersCount - * - * @return int - */ - public function getFollowersCount() - { - return $this->container['followersCount']; - } - - /** - * Sets followersCount - * - * @param int $followersCount Number of followers the user have - * - * @return $this - */ - public function setFollowersCount($followersCount) - { - $this->container['followersCount'] = $followersCount; - - return $this; - } - - /** - * Gets followingCount - * - * @return int - */ - public function getFollowingCount() - { - return $this->container['followingCount']; - } - - /** - * Sets followingCount - * - * @param int $followingCount Number of people the user follow - * - * @return $this - */ - public function setFollowingCount($followingCount) - { - $this->container['followingCount'] = $followingCount; - - return $this; - } - - /** - * Gets ownedPublicScoresCount - * - * @return int - */ - public function getOwnedPublicScoresCount() - { - return $this->container['ownedPublicScoresCount']; - } - - /** - * Sets ownedPublicScoresCount - * - * @param int $ownedPublicScoresCount Number of public scores the user have - * - * @return $this - */ - public function setOwnedPublicScoresCount($ownedPublicScoresCount) - { - $this->container['ownedPublicScoresCount'] = $ownedPublicScoresCount; - - return $this; - } - - /** - * Gets profileTheme - * - * @return string - */ - public function getProfileTheme() - { - return $this->container['profileTheme']; - } - - /** - * Sets profileTheme - * - * @param string $profileTheme Theme (background) for the profile - * - * @return $this - */ - public function setProfileTheme($profileTheme) - { - $this->container['profileTheme'] = $profileTheme; - - return $this; - } - - /** - * Gets instruments - * - * @return \Flat\APIClient\Model\UserInstruments - */ - public function getInstruments() - { - return $this->container['instruments']; - } - - /** - * Sets instruments - * - * @param \Flat\APIClient\Model\UserInstruments $instruments instruments - * - * @return $this - */ - public function setInstruments($instruments) - { - $this->container['instruments'] = $instruments; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/UserPublicSummary.php b/lib/Model/UserPublicSummary.php deleted file mode 100644 index 7b3e340..0000000 --- a/lib/Model/UserPublicSummary.php +++ /dev/null @@ -1,386 +0,0 @@ - 'string', - 'organizationRole' => '\Flat\APIClient\Model\OrganizationRoles', - 'classRole' => '\Flat\APIClient\Model\ClassRoles', - 'htmlUrl' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'organization' => null, - 'organizationRole' => null, - 'classRole' => null, - 'htmlUrl' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes + parent::swaggerTypes(); - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats + parent::swaggerFormats(); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'organization' => 'organization', - 'organizationRole' => 'organizationRole', - 'classRole' => 'classRole', - 'htmlUrl' => 'htmlUrl' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'organization' => 'setOrganization', - 'organizationRole' => 'setOrganizationRole', - 'classRole' => 'setClassRole', - 'htmlUrl' => 'setHtmlUrl' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'organization' => 'getOrganization', - 'organizationRole' => 'getOrganizationRole', - 'classRole' => 'getClassRole', - 'htmlUrl' => 'getHtmlUrl' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return parent::attributeMap() + self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return parent::setters() + self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return parent::getters() + self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$swaggerModelName; - } - - - - - - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - parent::__construct($data); - - $this->container['organization'] = isset($data['organization']) ? $data['organization'] : null; - $this->container['organizationRole'] = isset($data['organizationRole']) ? $data['organizationRole'] : null; - $this->container['classRole'] = isset($data['classRole']) ? $data['classRole'] : null; - $this->container['htmlUrl'] = isset($data['htmlUrl']) ? $data['htmlUrl'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = parent::listInvalidProperties(); - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets organization - * - * @return string - */ - public function getOrganization() - { - return $this->container['organization']; - } - - /** - * Sets organization - * - * @param string $organization Organization ID (for Edu users only) - * - * @return $this - */ - public function setOrganization($organization) - { - $this->container['organization'] = $organization; - - return $this; - } - - /** - * Gets organizationRole - * - * @return \Flat\APIClient\Model\OrganizationRoles - */ - public function getOrganizationRole() - { - return $this->container['organizationRole']; - } - - /** - * Sets organizationRole - * - * @param \Flat\APIClient\Model\OrganizationRoles $organizationRole organizationRole - * - * @return $this - */ - public function setOrganizationRole($organizationRole) - { - $this->container['organizationRole'] = $organizationRole; - - return $this; - } - - /** - * Gets classRole - * - * @return \Flat\APIClient\Model\ClassRoles - */ - public function getClassRole() - { - return $this->container['classRole']; - } - - /** - * Sets classRole - * - * @param \Flat\APIClient\Model\ClassRoles $classRole classRole - * - * @return $this - */ - public function setClassRole($classRole) - { - $this->container['classRole'] = $classRole; - - return $this; - } - - /** - * Gets htmlUrl - * - * @return string - */ - public function getHtmlUrl() - { - return $this->container['htmlUrl']; - } - - /** - * Sets htmlUrl - * - * @param string $htmlUrl Link to user profile (for Indiv. users only) - * - * @return $this - */ - public function setHtmlUrl($htmlUrl) - { - $this->container['htmlUrl'] = $htmlUrl; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/ObjectSerializer.php b/lib/ObjectSerializer.php deleted file mode 100644 index 49cc1a1..0000000 --- a/lib/ObjectSerializer.php +++ /dev/null @@ -1,317 +0,0 @@ -format('Y-m-d') : $data->format(\DateTime::ATOM); - } elseif (is_array($data)) { - foreach ($data as $property => $value) { - $data[$property] = self::sanitizeForSerialization($value); - } - return $data; - } elseif (is_object($data)) { - $values = []; - $formats = $data::swaggerFormats(); - foreach ($data::swaggerTypes() as $property => $swaggerType) { - $getter = $data::getters()[$property]; - $value = $data->$getter(); - if ($value !== null - && !in_array($swaggerType, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true) - && method_exists($swaggerType, 'getAllowableEnumValues') - && !in_array($value, $swaggerType::getAllowableEnumValues())) { - $imploded = implode("', '", $swaggerType::getAllowableEnumValues()); - throw new \InvalidArgumentException("Invalid value for enum '$swaggerType', must be one of: '$imploded'"); - } - if ($value !== null) { - $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $swaggerType, $formats[$property]); - } - } - return (object)$values; - } else { - return (string)$data; - } - } - - /** - * Sanitize filename by removing path. - * e.g. ../../sun.gif becomes sun.gif - * - * @param string $filename filename to be sanitized - * - * @return string the sanitized filename - */ - public static function sanitizeFilename($filename) - { - if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { - return $match[1]; - } else { - return $filename; - } - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the path, by url-encoding. - * - * @param string $value a string which will be part of the path - * - * @return string the serialized object - */ - public static function toPathValue($value) - { - return rawurlencode(self::toString($value)); - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the query, by imploding comma-separated if it's an object. - * If it's a string, pass through unchanged. It will be url-encoded - * later. - * - * @param string[]|string|\DateTime $object an object to be serialized to a string - * - * @return string the serialized object - */ - public static function toQueryValue($object) - { - if (is_array($object)) { - return implode(',', $object); - } else { - return self::toString($object); - } - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the header. If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string $value a string which will be part of the header - * - * @return string the header string - */ - public static function toHeaderValue($value) - { - return self::toString($value); - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the http body (form parameter). If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string|\SplFileObject $value the value of the form parameter - * - * @return string the form string - */ - public static function toFormValue($value) - { - if ($value instanceof \SplFileObject) { - return $value->getRealPath(); - } else { - return self::toString($value); - } - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the parameter. If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string|\DateTime $value the value of the parameter - * - * @return string the header string - */ - public static function toString($value) - { - if ($value instanceof \DateTime) { // datetime in ISO8601 format - return $value->format(\DateTime::ATOM); - } else { - return $value; - } - } - - /** - * Serialize an array to a string. - * - * @param array $collection collection to serialize to a string - * @param string $collectionFormat the format use for serialization (csv, - * ssv, tsv, pipes, multi) - * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array - * - * @return string - */ - public static function serializeCollection(array $collection, $collectionFormat, $allowCollectionFormatMulti = false) - { - if ($allowCollectionFormatMulti && ('multi' === $collectionFormat)) { - // http_build_query() almost does the job for us. We just - // need to fix the result of multidimensional arrays. - return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); - } - switch ($collectionFormat) { - case 'pipes': - return implode('|', $collection); - - case 'tsv': - return implode("\t", $collection); - - case 'ssv': - return implode(' ', $collection); - - case 'csv': - // Deliberate fall through. CSV is default format. - default: - return implode(',', $collection); - } - } - - /** - * Deserialize a JSON string into an object - * - * @param mixed $data object or primitive to be deserialized - * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used - * - * @return object|array|null an single or an array of $class instances - */ - public static function deserialize($data, $class, $httpHeaders = null) - { - if (null === $data) { - return null; - } elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int] - $inner = substr($class, 4, -1); - $deserialized = []; - if (strrpos($inner, ",") !== false) { - $subClass_array = explode(',', $inner, 2); - $subClass = $subClass_array[1]; - foreach ($data as $key => $value) { - $deserialized[$key] = self::deserialize($value, $subClass, null); - } - } - return $deserialized; - } elseif (strcasecmp(substr($class, -2), '[]') === 0) { - $subClass = substr($class, 0, -2); - $values = []; - foreach ($data as $key => $value) { - $values[] = self::deserialize($value, $subClass, null); - } - return $values; - } elseif ($class === 'object') { - settype($data, 'array'); - return $data; - } elseif ($class === '\DateTime') { - // Some API's return an invalid, empty string as a - // date-time property. DateTime::__construct() will return - // the current time for empty input which is probably not - // what is meant. The invalid empty string is probably to - // be interpreted as a missing field/value. Let's handle - // this graceful. - if (!empty($data)) { - return new \DateTime($data); - } else { - return null; - } - } elseif (in_array($class, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { - settype($data, $class); - return $data; - } elseif ($class === '\SplFileObject') { - /** @var \Psr\Http\Message\StreamInterface $data */ - - // determine file name - if (array_key_exists('Content-Disposition', $httpHeaders) && - preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)) { - $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); - } else { - $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); - } - - $file = fopen($filename, 'w'); - while ($chunk = $data->read(200)) { - fwrite($file, $chunk); - } - fclose($file); - - return new \SplFileObject($filename, 'r'); - } elseif (method_exists($class, 'getAllowableEnumValues')) { - if (!in_array($data, $class::getAllowableEnumValues())) { - $imploded = implode("', '", $class::getAllowableEnumValues()); - throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); - } - return $data; - } else { - // If a discriminator is defined and points to a valid subclass, use it. - $discriminator = $class::DISCRIMINATOR; - if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { - $subclass = '\Flat\APIClient\Model\\' . $data->{$discriminator}; - if (is_subclass_of($subclass, $class)) { - $class = $subclass; - } - } - $instance = new $class(); - foreach ($instance::swaggerTypes() as $property => $type) { - $propertySetter = $instance::setters()[$property]; - - if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { - continue; - } - - $propertyValue = $data->{$instance::attributeMap()[$property]}; - if (isset($propertyValue)) { - $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); - } - } - return $instance; - } - } -} diff --git a/phpunit.xml.dist b/phpunit.xml.dist deleted file mode 100644 index c12ee14..0000000 --- a/phpunit.xml.dist +++ /dev/null @@ -1,21 +0,0 @@ - - - - - ./test/Api - ./test/Model - - - - - - ./lib/Api - ./lib/Model - - - diff --git a/src/Api/AccountApi.php b/src/Api/AccountApi.php new file mode 100644 index 0000000..0885b58 --- /dev/null +++ b/src/Api/AccountApi.php @@ -0,0 +1,453 @@ + $contentTypes **/ + public const contentTypes = [ + 'getAuthenticatedUser' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation getAuthenticatedUser + * + * Get current user account + * + * @param bool|null $only_id Only return the user id (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAuthenticatedUser'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\UserDetails|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getAuthenticatedUser( + ?bool $only_id = false, + string $contentType = self::contentTypes['getAuthenticatedUser'][0] + ): \Flat\APIClient\Model\UserDetails|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getAuthenticatedUserWithHttpInfo($only_id, $contentType); + return $response; + } + + /** + * Operation getAuthenticatedUserWithHttpInfo + * + * Get current user account + * + * @param bool|null $only_id Only return the user id (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAuthenticatedUser'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\UserDetails|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getAuthenticatedUserWithHttpInfo( + ?bool $only_id = false, + string $contentType = self::contentTypes['getAuthenticatedUser'][0] + ): array + { + $request = $this->getAuthenticatedUserRequest($only_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\UserDetails', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\UserDetails', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\UserDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getAuthenticatedUserAsync + * + * Get current user account + * + * @param bool|null $only_id Only return the user id (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAuthenticatedUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getAuthenticatedUserAsync( + ?bool $only_id = false, + string $contentType = self::contentTypes['getAuthenticatedUser'][0] + ): PromiseInterface + { + return $this->getAuthenticatedUserAsyncWithHttpInfo($only_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAuthenticatedUserAsyncWithHttpInfo + * + * Get current user account + * + * @param bool|null $only_id Only return the user id (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAuthenticatedUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getAuthenticatedUserAsyncWithHttpInfo( + ?bool $only_id = false, + string $contentType = self::contentTypes['getAuthenticatedUser'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\UserDetails'; + $request = $this->getAuthenticatedUserRequest($only_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAuthenticatedUser' + * + * @param bool|null $only_id Only return the user id (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAuthenticatedUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAuthenticatedUserRequest( + ?bool $only_id = false, + string $contentType = self::contentTypes['getAuthenticatedUser'][0] + ): Request + { + + $resourcePath = '/me'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $only_id, + 'onlyId', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/src/Api/ClassApi.php b/src/Api/ClassApi.php new file mode 100644 index 0000000..a4ba0fa --- /dev/null +++ b/src/Api/ClassApi.php @@ -0,0 +1,10278 @@ + $contentTypes **/ + public const contentTypes = [ + 'activateClass' => [ + 'application/json', + ], + 'addClassUser' => [ + 'application/json', + ], + 'archiveAssignment' => [ + 'application/json', + ], + 'archiveClass' => [ + 'application/json', + ], + 'copyAssignment' => [ + 'application/json', + ], + 'createClass' => [ + 'application/json', + ], + 'createClassAssignment' => [ + 'application/json', + ], + 'createSubmission' => [ + 'application/json', + ], + 'createTestStudentAccount' => [ + 'application/json', + ], + 'deleteAssignment' => [ + 'application/json', + ], + 'deleteClassUser' => [ + 'application/json', + ], + 'deleteSubmission' => [ + 'application/json', + ], + 'deleteSubmissionComment' => [ + 'application/json', + ], + 'editSubmission' => [ + 'application/json', + ], + 'enrollClass' => [ + 'application/json', + ], + 'exportSubmissionsReviewsAsCsv' => [ + 'application/json', + ], + 'exportSubmissionsReviewsAsExcel' => [ + 'application/json', + ], + 'getAssignment' => [ + 'application/json', + ], + 'getClass' => [ + 'application/json', + ], + 'getScoreSubmissions' => [ + 'application/json', + ], + 'getSubmission' => [ + 'application/json', + ], + 'getSubmissionComments' => [ + 'application/json', + ], + 'getSubmissionHistory' => [ + 'application/json', + ], + 'getSubmissions' => [ + 'application/json', + ], + 'listAssignments' => [ + 'application/json', + ], + 'listClassStudentSubmissions' => [ + 'application/json', + ], + 'listClasses' => [ + 'application/json', + ], + 'postSubmissionComment' => [ + 'application/json', + ], + 'unarchiveAssignment' => [ + 'application/json', + ], + 'unarchiveClass' => [ + 'application/json', + ], + 'updateClass' => [ + 'application/json', + ], + 'updateClassAssignment' => [ + 'application/json', + ], + 'updateSubmissionComment' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation activateClass + * + * Activate the class + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['activateClass'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ClassDetails|\Flat\APIClient\Model\FlatErrorResponse + */ + public function activateClass( + string $class, + string $contentType = self::contentTypes['activateClass'][0] + ): \Flat\APIClient\Model\ClassDetails|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->activateClassWithHttpInfo($class, $contentType); + return $response; + } + + /** + * Operation activateClassWithHttpInfo + * + * Activate the class + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['activateClass'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ClassDetails|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function activateClassWithHttpInfo( + string $class, + string $contentType = self::contentTypes['activateClass'][0] + ): array + { + $request = $this->activateClassRequest($class, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ClassDetails', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ClassDetails', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ClassDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation activateClassAsync + * + * Activate the class + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['activateClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function activateClassAsync( + string $class, + string $contentType = self::contentTypes['activateClass'][0] + ): PromiseInterface + { + return $this->activateClassAsyncWithHttpInfo($class, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation activateClassAsyncWithHttpInfo + * + * Activate the class + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['activateClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function activateClassAsyncWithHttpInfo( + string $class, + string $contentType = self::contentTypes['activateClass'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ClassDetails'; + $request = $this->activateClassRequest($class, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'activateClass' + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['activateClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function activateClassRequest( + string $class, + string $contentType = self::contentTypes['activateClass'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling activateClass' + ); + } + + $resourcePath = '/classes/{class}/activate'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation addClassUser + * + * Add a user to the class + * + * @param string $class Unique identifier of the class (required) + * @param string $user Unique identifier of the user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addClassUser'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\FlatErrorResponse|null + */ + public function addClassUser( + string $class, + string $user, + string $contentType = self::contentTypes['addClassUser'][0] + ): ?\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->addClassUserWithHttpInfo($class, $user, $contentType); + return $response; + } + + /** + * Operation addClassUserWithHttpInfo + * + * Add a user to the class + * + * @param string $class Unique identifier of the class (required) + * @param string $user Unique identifier of the user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addClassUser'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function addClassUserWithHttpInfo( + string $class, + string $user, + string $contentType = self::contentTypes['addClassUser'][0] + ): array + { + $request = $this->addClassUserRequest($class, $user, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation addClassUserAsync + * + * Add a user to the class + * + * @param string $class Unique identifier of the class (required) + * @param string $user Unique identifier of the user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addClassUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function addClassUserAsync( + string $class, + string $user, + string $contentType = self::contentTypes['addClassUser'][0] + ): PromiseInterface + { + return $this->addClassUserAsyncWithHttpInfo($class, $user, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addClassUserAsyncWithHttpInfo + * + * Add a user to the class + * + * @param string $class Unique identifier of the class (required) + * @param string $user Unique identifier of the user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addClassUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function addClassUserAsyncWithHttpInfo( + string $class, + string $user, + string $contentType = self::contentTypes['addClassUser'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->addClassUserRequest($class, $user, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'addClassUser' + * + * @param string $class Unique identifier of the class (required) + * @param string $user Unique identifier of the user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addClassUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function addClassUserRequest( + string $class, + string $user, + string $contentType = self::contentTypes['addClassUser'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling addClassUser' + ); + } + // verify the required parameter 'user' is set + if ($user === null || (is_array($user) && count($user) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $user when calling addClassUser' + ); + } + + $resourcePath = '/classes/{class}/users/{user}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + // path params + if ($user !== null) { + $resourcePath = str_replace( + '{user}', + ObjectSerializer::toPathValue($user), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation archiveAssignment + * + * Archive the assignment + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveAssignment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\Assignment|\Flat\APIClient\Model\FlatErrorResponse + */ + public function archiveAssignment( + string $class, + string $assignment, + string $contentType = self::contentTypes['archiveAssignment'][0] + ): \Flat\APIClient\Model\Assignment|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->archiveAssignmentWithHttpInfo($class, $assignment, $contentType); + return $response; + } + + /** + * Operation archiveAssignmentWithHttpInfo + * + * Archive the assignment + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveAssignment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\Assignment|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function archiveAssignmentWithHttpInfo( + string $class, + string $assignment, + string $contentType = self::contentTypes['archiveAssignment'][0] + ): array + { + $request = $this->archiveAssignmentRequest($class, $assignment, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Assignment', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Assignment', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\Assignment', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation archiveAssignmentAsync + * + * Archive the assignment + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function archiveAssignmentAsync( + string $class, + string $assignment, + string $contentType = self::contentTypes['archiveAssignment'][0] + ): PromiseInterface + { + return $this->archiveAssignmentAsyncWithHttpInfo($class, $assignment, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation archiveAssignmentAsyncWithHttpInfo + * + * Archive the assignment + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function archiveAssignmentAsyncWithHttpInfo( + string $class, + string $assignment, + string $contentType = self::contentTypes['archiveAssignment'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\Assignment'; + $request = $this->archiveAssignmentRequest($class, $assignment, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'archiveAssignment' + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function archiveAssignmentRequest( + string $class, + string $assignment, + string $contentType = self::contentTypes['archiveAssignment'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling archiveAssignment' + ); + } + // verify the required parameter 'assignment' is set + if ($assignment === null || (is_array($assignment) && count($assignment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $assignment when calling archiveAssignment' + ); + } + + $resourcePath = '/classes/{class}/assignments/{assignment}/archive'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + // path params + if ($assignment !== null) { + $resourcePath = str_replace( + '{assignment}', + ObjectSerializer::toPathValue($assignment), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation archiveClass + * + * Archive the class + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveClass'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ClassDetails|\Flat\APIClient\Model\FlatErrorResponse + */ + public function archiveClass( + string $class, + string $contentType = self::contentTypes['archiveClass'][0] + ): \Flat\APIClient\Model\ClassDetails|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->archiveClassWithHttpInfo($class, $contentType); + return $response; + } + + /** + * Operation archiveClassWithHttpInfo + * + * Archive the class + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveClass'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ClassDetails|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function archiveClassWithHttpInfo( + string $class, + string $contentType = self::contentTypes['archiveClass'][0] + ): array + { + $request = $this->archiveClassRequest($class, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ClassDetails', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ClassDetails', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ClassDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation archiveClassAsync + * + * Archive the class + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function archiveClassAsync( + string $class, + string $contentType = self::contentTypes['archiveClass'][0] + ): PromiseInterface + { + return $this->archiveClassAsyncWithHttpInfo($class, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation archiveClassAsyncWithHttpInfo + * + * Archive the class + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function archiveClassAsyncWithHttpInfo( + string $class, + string $contentType = self::contentTypes['archiveClass'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ClassDetails'; + $request = $this->archiveClassRequest($class, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'archiveClass' + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function archiveClassRequest( + string $class, + string $contentType = self::contentTypes['archiveClass'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling archiveClass' + ); + } + + $resourcePath = '/classes/{class}/archive'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation copyAssignment + * + * Copy an assignment + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param \Flat\APIClient\Model\AssignmentCopyToClass|\Flat\APIClient\Model\AssignmentCopyToResourceLibrary $body body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['copyAssignment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\AssignmentCopyResponse|\Flat\APIClient\Model\FlatErrorResponse + */ + public function copyAssignment( + string $class, + string $assignment, + \Flat\APIClient\Model\AssignmentCopyToClass|\Flat\APIClient\Model\AssignmentCopyToResourceLibrary $body, + string $contentType = self::contentTypes['copyAssignment'][0] + ): \Flat\APIClient\Model\AssignmentCopyResponse|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->copyAssignmentWithHttpInfo($class, $assignment, $body, $contentType); + return $response; + } + + /** + * Operation copyAssignmentWithHttpInfo + * + * Copy an assignment + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param \Flat\APIClient\Model\AssignmentCopyToClass|\Flat\APIClient\Model\AssignmentCopyToResourceLibrary $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['copyAssignment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\AssignmentCopyResponse|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function copyAssignmentWithHttpInfo( + string $class, + string $assignment, + \Flat\APIClient\Model\AssignmentCopyToClass|\Flat\APIClient\Model\AssignmentCopyToResourceLibrary $body, + string $contentType = self::contentTypes['copyAssignment'][0] + ): array + { + $request = $this->copyAssignmentRequest($class, $assignment, $body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentCopyResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentCopyResponse', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\AssignmentCopyResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation copyAssignmentAsync + * + * Copy an assignment + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param \Flat\APIClient\Model\AssignmentCopyToClass|\Flat\APIClient\Model\AssignmentCopyToResourceLibrary $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['copyAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function copyAssignmentAsync( + string $class, + string $assignment, + \Flat\APIClient\Model\AssignmentCopyToClass|\Flat\APIClient\Model\AssignmentCopyToResourceLibrary $body, + string $contentType = self::contentTypes['copyAssignment'][0] + ): PromiseInterface + { + return $this->copyAssignmentAsyncWithHttpInfo($class, $assignment, $body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation copyAssignmentAsyncWithHttpInfo + * + * Copy an assignment + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param \Flat\APIClient\Model\AssignmentCopyToClass|\Flat\APIClient\Model\AssignmentCopyToResourceLibrary $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['copyAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function copyAssignmentAsyncWithHttpInfo( + string $class, + string $assignment, + \Flat\APIClient\Model\AssignmentCopyToClass|\Flat\APIClient\Model\AssignmentCopyToResourceLibrary $body, + string $contentType = self::contentTypes['copyAssignment'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\AssignmentCopyResponse'; + $request = $this->copyAssignmentRequest($class, $assignment, $body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'copyAssignment' + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param \Flat\APIClient\Model\AssignmentCopyToClass|\Flat\APIClient\Model\AssignmentCopyToResourceLibrary $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['copyAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function copyAssignmentRequest( + string $class, + string $assignment, + \Flat\APIClient\Model\AssignmentCopyToClass|\Flat\APIClient\Model\AssignmentCopyToResourceLibrary $body, + string $contentType = self::contentTypes['copyAssignment'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling copyAssignment' + ); + } + // verify the required parameter 'assignment' is set + if ($assignment === null || (is_array($assignment) && count($assignment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $assignment when calling copyAssignment' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling copyAssignment' + ); + } + + $resourcePath = '/classes/{class}/assignments/{assignment}/copy'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + // path params + if ($assignment !== null) { + $resourcePath = str_replace( + '{assignment}', + ObjectSerializer::toPathValue($assignment), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createClass + * + * Create a new class + * + * @param \Flat\APIClient\Model\ClassCreation $body body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createClass'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ClassDetails|\Flat\APIClient\Model\FlatErrorResponse + */ + public function createClass( + \Flat\APIClient\Model\ClassCreation $body, + string $contentType = self::contentTypes['createClass'][0] + ): \Flat\APIClient\Model\ClassDetails|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->createClassWithHttpInfo($body, $contentType); + return $response; + } + + /** + * Operation createClassWithHttpInfo + * + * Create a new class + * + * @param \Flat\APIClient\Model\ClassCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createClass'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ClassDetails|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createClassWithHttpInfo( + \Flat\APIClient\Model\ClassCreation $body, + string $contentType = self::contentTypes['createClass'][0] + ): array + { + $request = $this->createClassRequest($body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ClassDetails', + $request, + $response, + ); + case 402: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ClassDetails', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ClassDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createClassAsync + * + * Create a new class + * + * @param \Flat\APIClient\Model\ClassCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createClassAsync( + \Flat\APIClient\Model\ClassCreation $body, + string $contentType = self::contentTypes['createClass'][0] + ): PromiseInterface + { + return $this->createClassAsyncWithHttpInfo($body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createClassAsyncWithHttpInfo + * + * Create a new class + * + * @param \Flat\APIClient\Model\ClassCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createClassAsyncWithHttpInfo( + \Flat\APIClient\Model\ClassCreation $body, + string $contentType = self::contentTypes['createClass'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ClassDetails'; + $request = $this->createClassRequest($body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createClass' + * + * @param \Flat\APIClient\Model\ClassCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createClassRequest( + \Flat\APIClient\Model\ClassCreation $body, + string $contentType = self::contentTypes['createClass'][0] + ): Request + { + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling createClass' + ); + } + + $resourcePath = '/classes'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createClassAssignment + * + * Assignment creation + * + * @param string $class Unique identifier of the class (required) + * @param \Flat\APIClient\Model\ClassAssignmentUpdate $body body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createClassAssignment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\Assignment|\Flat\APIClient\Model\FlatErrorResponse + */ + public function createClassAssignment( + string $class, + \Flat\APIClient\Model\ClassAssignmentUpdate $body, + string $contentType = self::contentTypes['createClassAssignment'][0] + ): \Flat\APIClient\Model\Assignment|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->createClassAssignmentWithHttpInfo($class, $body, $contentType); + return $response; + } + + /** + * Operation createClassAssignmentWithHttpInfo + * + * Assignment creation + * + * @param string $class Unique identifier of the class (required) + * @param \Flat\APIClient\Model\ClassAssignmentUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createClassAssignment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\Assignment|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createClassAssignmentWithHttpInfo( + string $class, + \Flat\APIClient\Model\ClassAssignmentUpdate $body, + string $contentType = self::contentTypes['createClassAssignment'][0] + ): array + { + $request = $this->createClassAssignmentRequest($class, $body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Assignment', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Assignment', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\Assignment', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createClassAssignmentAsync + * + * Assignment creation + * + * @param string $class Unique identifier of the class (required) + * @param \Flat\APIClient\Model\ClassAssignmentUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createClassAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createClassAssignmentAsync( + string $class, + \Flat\APIClient\Model\ClassAssignmentUpdate $body, + string $contentType = self::contentTypes['createClassAssignment'][0] + ): PromiseInterface + { + return $this->createClassAssignmentAsyncWithHttpInfo($class, $body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createClassAssignmentAsyncWithHttpInfo + * + * Assignment creation + * + * @param string $class Unique identifier of the class (required) + * @param \Flat\APIClient\Model\ClassAssignmentUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createClassAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createClassAssignmentAsyncWithHttpInfo( + string $class, + \Flat\APIClient\Model\ClassAssignmentUpdate $body, + string $contentType = self::contentTypes['createClassAssignment'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\Assignment'; + $request = $this->createClassAssignmentRequest($class, $body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createClassAssignment' + * + * @param string $class Unique identifier of the class (required) + * @param \Flat\APIClient\Model\ClassAssignmentUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createClassAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createClassAssignmentRequest( + string $class, + \Flat\APIClient\Model\ClassAssignmentUpdate $body, + string $contentType = self::contentTypes['createClassAssignment'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling createClassAssignment' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling createClassAssignment' + ); + } + + $resourcePath = '/classes/{class}/assignments'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createSubmission + * + * Create or edit a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param \Flat\APIClient\Model\AssignmentSubmissionUpdate $body body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSubmission'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\AssignmentSubmission|\Flat\APIClient\Model\FlatErrorResponse + */ + public function createSubmission( + string $class, + string $assignment, + \Flat\APIClient\Model\AssignmentSubmissionUpdate $body, + string $contentType = self::contentTypes['createSubmission'][0] + ): \Flat\APIClient\Model\AssignmentSubmission|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->createSubmissionWithHttpInfo($class, $assignment, $body, $contentType); + return $response; + } + + /** + * Operation createSubmissionWithHttpInfo + * + * Create or edit a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param \Flat\APIClient\Model\AssignmentSubmissionUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSubmission'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\AssignmentSubmission|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createSubmissionWithHttpInfo( + string $class, + string $assignment, + \Flat\APIClient\Model\AssignmentSubmissionUpdate $body, + string $contentType = self::contentTypes['createSubmission'][0] + ): array + { + $request = $this->createSubmissionRequest($class, $assignment, $body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmission', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmission', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\AssignmentSubmission', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createSubmissionAsync + * + * Create or edit a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param \Flat\APIClient\Model\AssignmentSubmissionUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSubmission'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createSubmissionAsync( + string $class, + string $assignment, + \Flat\APIClient\Model\AssignmentSubmissionUpdate $body, + string $contentType = self::contentTypes['createSubmission'][0] + ): PromiseInterface + { + return $this->createSubmissionAsyncWithHttpInfo($class, $assignment, $body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createSubmissionAsyncWithHttpInfo + * + * Create or edit a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param \Flat\APIClient\Model\AssignmentSubmissionUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSubmission'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createSubmissionAsyncWithHttpInfo( + string $class, + string $assignment, + \Flat\APIClient\Model\AssignmentSubmissionUpdate $body, + string $contentType = self::contentTypes['createSubmission'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\AssignmentSubmission'; + $request = $this->createSubmissionRequest($class, $assignment, $body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createSubmission' + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param \Flat\APIClient\Model\AssignmentSubmissionUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSubmission'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createSubmissionRequest( + string $class, + string $assignment, + \Flat\APIClient\Model\AssignmentSubmissionUpdate $body, + string $contentType = self::contentTypes['createSubmission'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling createSubmission' + ); + } + // verify the required parameter 'assignment' is set + if ($assignment === null || (is_array($assignment) && count($assignment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $assignment when calling createSubmission' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling createSubmission' + ); + } + + $resourcePath = '/classes/{class}/assignments/{assignment}/submissions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + // path params + if ($assignment !== null) { + $resourcePath = str_replace( + '{assignment}', + ObjectSerializer::toPathValue($assignment), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createTestStudentAccount + * + * Create a test student account + * + * @param string $class Unique identifier of the class (required) + * @param bool|null $reset If true, the testing account will be re-created. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTestStudentAccount'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\UserDetails|\Flat\APIClient\Model\FlatErrorResponse + */ + public function createTestStudentAccount( + string $class, + ?bool $reset = null, + string $contentType = self::contentTypes['createTestStudentAccount'][0] + ): \Flat\APIClient\Model\UserDetails|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->createTestStudentAccountWithHttpInfo($class, $reset, $contentType); + return $response; + } + + /** + * Operation createTestStudentAccountWithHttpInfo + * + * Create a test student account + * + * @param string $class Unique identifier of the class (required) + * @param bool|null $reset If true, the testing account will be re-created. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTestStudentAccount'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\UserDetails|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createTestStudentAccountWithHttpInfo( + string $class, + ?bool $reset = null, + string $contentType = self::contentTypes['createTestStudentAccount'][0] + ): array + { + $request = $this->createTestStudentAccountRequest($class, $reset, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\UserDetails', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\UserDetails', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\UserDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createTestStudentAccountAsync + * + * Create a test student account + * + * @param string $class Unique identifier of the class (required) + * @param bool|null $reset If true, the testing account will be re-created. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTestStudentAccount'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createTestStudentAccountAsync( + string $class, + ?bool $reset = null, + string $contentType = self::contentTypes['createTestStudentAccount'][0] + ): PromiseInterface + { + return $this->createTestStudentAccountAsyncWithHttpInfo($class, $reset, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createTestStudentAccountAsyncWithHttpInfo + * + * Create a test student account + * + * @param string $class Unique identifier of the class (required) + * @param bool|null $reset If true, the testing account will be re-created. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTestStudentAccount'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createTestStudentAccountAsyncWithHttpInfo( + string $class, + ?bool $reset = null, + string $contentType = self::contentTypes['createTestStudentAccount'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\UserDetails'; + $request = $this->createTestStudentAccountRequest($class, $reset, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createTestStudentAccount' + * + * @param string $class Unique identifier of the class (required) + * @param bool|null $reset If true, the testing account will be re-created. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTestStudentAccount'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createTestStudentAccountRequest( + string $class, + ?bool $reset = null, + string $contentType = self::contentTypes['createTestStudentAccount'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling createTestStudentAccount' + ); + } + + $resourcePath = '/classes/{class}/testStudent'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $reset, + 'reset', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteAssignment + * + * Delete an assignment + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAssignment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\FlatErrorResponse|null + */ + public function deleteAssignment( + string $class, + string $assignment, + string $contentType = self::contentTypes['deleteAssignment'][0] + ): ?\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->deleteAssignmentWithHttpInfo($class, $assignment, $contentType); + return $response; + } + + /** + * Operation deleteAssignmentWithHttpInfo + * + * Delete an assignment + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAssignment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function deleteAssignmentWithHttpInfo( + string $class, + string $assignment, + string $contentType = self::contentTypes['deleteAssignment'][0] + ): array + { + $request = $this->deleteAssignmentRequest($class, $assignment, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation deleteAssignmentAsync + * + * Delete an assignment + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteAssignmentAsync( + string $class, + string $assignment, + string $contentType = self::contentTypes['deleteAssignment'][0] + ): PromiseInterface + { + return $this->deleteAssignmentAsyncWithHttpInfo($class, $assignment, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteAssignmentAsyncWithHttpInfo + * + * Delete an assignment + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteAssignmentAsyncWithHttpInfo( + string $class, + string $assignment, + string $contentType = self::contentTypes['deleteAssignment'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deleteAssignmentRequest($class, $assignment, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteAssignment' + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteAssignmentRequest( + string $class, + string $assignment, + string $contentType = self::contentTypes['deleteAssignment'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling deleteAssignment' + ); + } + // verify the required parameter 'assignment' is set + if ($assignment === null || (is_array($assignment) && count($assignment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $assignment when calling deleteAssignment' + ); + } + + $resourcePath = '/classes/{class}/assignments/{assignment}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + // path params + if ($assignment !== null) { + $resourcePath = str_replace( + '{assignment}', + ObjectSerializer::toPathValue($assignment), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteClassUser + * + * Remove a user from the class + * + * @param string $class Unique identifier of the class (required) + * @param string $user Unique identifier of the user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteClassUser'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\FlatErrorResponse|null + */ + public function deleteClassUser( + string $class, + string $user, + string $contentType = self::contentTypes['deleteClassUser'][0] + ): ?\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->deleteClassUserWithHttpInfo($class, $user, $contentType); + return $response; + } + + /** + * Operation deleteClassUserWithHttpInfo + * + * Remove a user from the class + * + * @param string $class Unique identifier of the class (required) + * @param string $user Unique identifier of the user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteClassUser'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function deleteClassUserWithHttpInfo( + string $class, + string $user, + string $contentType = self::contentTypes['deleteClassUser'][0] + ): array + { + $request = $this->deleteClassUserRequest($class, $user, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation deleteClassUserAsync + * + * Remove a user from the class + * + * @param string $class Unique identifier of the class (required) + * @param string $user Unique identifier of the user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteClassUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteClassUserAsync( + string $class, + string $user, + string $contentType = self::contentTypes['deleteClassUser'][0] + ): PromiseInterface + { + return $this->deleteClassUserAsyncWithHttpInfo($class, $user, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteClassUserAsyncWithHttpInfo + * + * Remove a user from the class + * + * @param string $class Unique identifier of the class (required) + * @param string $user Unique identifier of the user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteClassUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteClassUserAsyncWithHttpInfo( + string $class, + string $user, + string $contentType = self::contentTypes['deleteClassUser'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deleteClassUserRequest($class, $user, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteClassUser' + * + * @param string $class Unique identifier of the class (required) + * @param string $user Unique identifier of the user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteClassUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteClassUserRequest( + string $class, + string $user, + string $contentType = self::contentTypes['deleteClassUser'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling deleteClassUser' + ); + } + // verify the required parameter 'user' is set + if ($user === null || (is_array($user) && count($user) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $user when calling deleteClassUser' + ); + } + + $resourcePath = '/classes/{class}/users/{user}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + // path params + if ($user !== null) { + $resourcePath = str_replace( + '{user}', + ObjectSerializer::toPathValue($user), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteSubmission + * + * Reset a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSubmission'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\AssignmentSubmission|\Flat\APIClient\Model\FlatErrorResponse + */ + public function deleteSubmission( + string $class, + string $assignment, + string $submission, + string $contentType = self::contentTypes['deleteSubmission'][0] + ): \Flat\APIClient\Model\AssignmentSubmission|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->deleteSubmissionWithHttpInfo($class, $assignment, $submission, $contentType); + return $response; + } + + /** + * Operation deleteSubmissionWithHttpInfo + * + * Reset a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSubmission'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\AssignmentSubmission|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function deleteSubmissionWithHttpInfo( + string $class, + string $assignment, + string $submission, + string $contentType = self::contentTypes['deleteSubmission'][0] + ): array + { + $request = $this->deleteSubmissionRequest($class, $assignment, $submission, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmission', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmission', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\AssignmentSubmission', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation deleteSubmissionAsync + * + * Reset a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSubmission'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteSubmissionAsync( + string $class, + string $assignment, + string $submission, + string $contentType = self::contentTypes['deleteSubmission'][0] + ): PromiseInterface + { + return $this->deleteSubmissionAsyncWithHttpInfo($class, $assignment, $submission, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteSubmissionAsyncWithHttpInfo + * + * Reset a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSubmission'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteSubmissionAsyncWithHttpInfo( + string $class, + string $assignment, + string $submission, + string $contentType = self::contentTypes['deleteSubmission'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\AssignmentSubmission'; + $request = $this->deleteSubmissionRequest($class, $assignment, $submission, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteSubmission' + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSubmission'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteSubmissionRequest( + string $class, + string $assignment, + string $submission, + string $contentType = self::contentTypes['deleteSubmission'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling deleteSubmission' + ); + } + // verify the required parameter 'assignment' is set + if ($assignment === null || (is_array($assignment) && count($assignment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $assignment when calling deleteSubmission' + ); + } + // verify the required parameter 'submission' is set + if ($submission === null || (is_array($submission) && count($submission) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $submission when calling deleteSubmission' + ); + } + + $resourcePath = '/classes/{class}/assignments/{assignment}/submissions/{submission}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + // path params + if ($assignment !== null) { + $resourcePath = str_replace( + '{assignment}', + ObjectSerializer::toPathValue($assignment), + $resourcePath + ); + } + // path params + if ($submission !== null) { + $resourcePath = str_replace( + '{submission}', + ObjectSerializer::toPathValue($submission), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteSubmissionComment + * + * Delete a feedback comment to a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $comment Unique identifier of the comment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSubmissionComment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\FlatErrorResponse|null + */ + public function deleteSubmissionComment( + string $class, + string $assignment, + string $submission, + string $comment, + string $contentType = self::contentTypes['deleteSubmissionComment'][0] + ): ?\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->deleteSubmissionCommentWithHttpInfo($class, $assignment, $submission, $comment, $contentType); + return $response; + } + + /** + * Operation deleteSubmissionCommentWithHttpInfo + * + * Delete a feedback comment to a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $comment Unique identifier of the comment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSubmissionComment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function deleteSubmissionCommentWithHttpInfo( + string $class, + string $assignment, + string $submission, + string $comment, + string $contentType = self::contentTypes['deleteSubmissionComment'][0] + ): array + { + $request = $this->deleteSubmissionCommentRequest($class, $assignment, $submission, $comment, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation deleteSubmissionCommentAsync + * + * Delete a feedback comment to a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $comment Unique identifier of the comment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSubmissionComment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteSubmissionCommentAsync( + string $class, + string $assignment, + string $submission, + string $comment, + string $contentType = self::contentTypes['deleteSubmissionComment'][0] + ): PromiseInterface + { + return $this->deleteSubmissionCommentAsyncWithHttpInfo($class, $assignment, $submission, $comment, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteSubmissionCommentAsyncWithHttpInfo + * + * Delete a feedback comment to a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $comment Unique identifier of the comment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSubmissionComment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteSubmissionCommentAsyncWithHttpInfo( + string $class, + string $assignment, + string $submission, + string $comment, + string $contentType = self::contentTypes['deleteSubmissionComment'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deleteSubmissionCommentRequest($class, $assignment, $submission, $comment, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteSubmissionComment' + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $comment Unique identifier of the comment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSubmissionComment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteSubmissionCommentRequest( + string $class, + string $assignment, + string $submission, + string $comment, + string $contentType = self::contentTypes['deleteSubmissionComment'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling deleteSubmissionComment' + ); + } + // verify the required parameter 'assignment' is set + if ($assignment === null || (is_array($assignment) && count($assignment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $assignment when calling deleteSubmissionComment' + ); + } + // verify the required parameter 'submission' is set + if ($submission === null || (is_array($submission) && count($submission) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $submission when calling deleteSubmissionComment' + ); + } + // verify the required parameter 'comment' is set + if ($comment === null || (is_array($comment) && count($comment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $comment when calling deleteSubmissionComment' + ); + } + + $resourcePath = '/classes/{class}/assignments/{assignment}/submissions/{submission}/comments/{comment}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + // path params + if ($assignment !== null) { + $resourcePath = str_replace( + '{assignment}', + ObjectSerializer::toPathValue($assignment), + $resourcePath + ); + } + // path params + if ($submission !== null) { + $resourcePath = str_replace( + '{submission}', + ObjectSerializer::toPathValue($submission), + $resourcePath + ); + } + // path params + if ($comment !== null) { + $resourcePath = str_replace( + '{comment}', + ObjectSerializer::toPathValue($comment), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation editSubmission + * + * Edit a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param \Flat\APIClient\Model\AssignmentSubmissionUpdate $body body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['editSubmission'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\AssignmentSubmission|\Flat\APIClient\Model\FlatErrorResponse + */ + public function editSubmission( + string $class, + string $assignment, + string $submission, + \Flat\APIClient\Model\AssignmentSubmissionUpdate $body, + string $contentType = self::contentTypes['editSubmission'][0] + ): \Flat\APIClient\Model\AssignmentSubmission|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->editSubmissionWithHttpInfo($class, $assignment, $submission, $body, $contentType); + return $response; + } + + /** + * Operation editSubmissionWithHttpInfo + * + * Edit a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param \Flat\APIClient\Model\AssignmentSubmissionUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['editSubmission'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\AssignmentSubmission|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function editSubmissionWithHttpInfo( + string $class, + string $assignment, + string $submission, + \Flat\APIClient\Model\AssignmentSubmissionUpdate $body, + string $contentType = self::contentTypes['editSubmission'][0] + ): array + { + $request = $this->editSubmissionRequest($class, $assignment, $submission, $body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmission', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmission', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\AssignmentSubmission', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation editSubmissionAsync + * + * Edit a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param \Flat\APIClient\Model\AssignmentSubmissionUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['editSubmission'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function editSubmissionAsync( + string $class, + string $assignment, + string $submission, + \Flat\APIClient\Model\AssignmentSubmissionUpdate $body, + string $contentType = self::contentTypes['editSubmission'][0] + ): PromiseInterface + { + return $this->editSubmissionAsyncWithHttpInfo($class, $assignment, $submission, $body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation editSubmissionAsyncWithHttpInfo + * + * Edit a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param \Flat\APIClient\Model\AssignmentSubmissionUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['editSubmission'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function editSubmissionAsyncWithHttpInfo( + string $class, + string $assignment, + string $submission, + \Flat\APIClient\Model\AssignmentSubmissionUpdate $body, + string $contentType = self::contentTypes['editSubmission'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\AssignmentSubmission'; + $request = $this->editSubmissionRequest($class, $assignment, $submission, $body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'editSubmission' + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param \Flat\APIClient\Model\AssignmentSubmissionUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['editSubmission'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function editSubmissionRequest( + string $class, + string $assignment, + string $submission, + \Flat\APIClient\Model\AssignmentSubmissionUpdate $body, + string $contentType = self::contentTypes['editSubmission'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling editSubmission' + ); + } + // verify the required parameter 'assignment' is set + if ($assignment === null || (is_array($assignment) && count($assignment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $assignment when calling editSubmission' + ); + } + // verify the required parameter 'submission' is set + if ($submission === null || (is_array($submission) && count($submission) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $submission when calling editSubmission' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling editSubmission' + ); + } + + $resourcePath = '/classes/{class}/assignments/{assignment}/submissions/{submission}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + // path params + if ($assignment !== null) { + $resourcePath = str_replace( + '{assignment}', + ObjectSerializer::toPathValue($assignment), + $resourcePath + ); + } + // path params + if ($submission !== null) { + $resourcePath = str_replace( + '{submission}', + ObjectSerializer::toPathValue($submission), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation enrollClass + * + * Join a class + * + * @param string $enrollment_code The enrollment code, available to the teacher in `ClassDetails` (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enrollClass'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ClassDetails|\Flat\APIClient\Model\FlatErrorResponse + */ + public function enrollClass( + string $enrollment_code, + string $contentType = self::contentTypes['enrollClass'][0] + ): \Flat\APIClient\Model\ClassDetails|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->enrollClassWithHttpInfo($enrollment_code, $contentType); + return $response; + } + + /** + * Operation enrollClassWithHttpInfo + * + * Join a class + * + * @param string $enrollment_code The enrollment code, available to the teacher in `ClassDetails` (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enrollClass'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ClassDetails|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function enrollClassWithHttpInfo( + string $enrollment_code, + string $contentType = self::contentTypes['enrollClass'][0] + ): array + { + $request = $this->enrollClassRequest($enrollment_code, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ClassDetails', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ClassDetails', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ClassDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation enrollClassAsync + * + * Join a class + * + * @param string $enrollment_code The enrollment code, available to the teacher in `ClassDetails` (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enrollClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function enrollClassAsync( + string $enrollment_code, + string $contentType = self::contentTypes['enrollClass'][0] + ): PromiseInterface + { + return $this->enrollClassAsyncWithHttpInfo($enrollment_code, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation enrollClassAsyncWithHttpInfo + * + * Join a class + * + * @param string $enrollment_code The enrollment code, available to the teacher in `ClassDetails` (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enrollClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function enrollClassAsyncWithHttpInfo( + string $enrollment_code, + string $contentType = self::contentTypes['enrollClass'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ClassDetails'; + $request = $this->enrollClassRequest($enrollment_code, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'enrollClass' + * + * @param string $enrollment_code The enrollment code, available to the teacher in `ClassDetails` (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enrollClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function enrollClassRequest( + string $enrollment_code, + string $contentType = self::contentTypes['enrollClass'][0] + ): Request + { + // verify the required parameter 'enrollment_code' is set + if ($enrollment_code === null || (is_array($enrollment_code) && count($enrollment_code) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $enrollment_code when calling enrollClass' + ); + } + + $resourcePath = '/classes/enroll/{enrollmentCode}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($enrollment_code !== null) { + $resourcePath = str_replace( + '{enrollmentCode}', + ObjectSerializer::toPathValue($enrollment_code), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation exportSubmissionsReviewsAsCsv + * + * CSV Grades exports + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportSubmissionsReviewsAsCsv'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \SplFileObject|\Flat\APIClient\Model\FlatErrorResponse + */ + public function exportSubmissionsReviewsAsCsv( + string $class, + string $assignment, + string $contentType = self::contentTypes['exportSubmissionsReviewsAsCsv'][0] + ): \SplFileObject|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->exportSubmissionsReviewsAsCsvWithHttpInfo($class, $assignment, $contentType); + return $response; + } + + /** + * Operation exportSubmissionsReviewsAsCsvWithHttpInfo + * + * CSV Grades exports + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportSubmissionsReviewsAsCsv'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \SplFileObject|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function exportSubmissionsReviewsAsCsvWithHttpInfo( + string $class, + string $assignment, + string $contentType = self::contentTypes['exportSubmissionsReviewsAsCsv'][0] + ): array + { + $request = $this->exportSubmissionsReviewsAsCsvRequest($class, $assignment, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\SplFileObject', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\SplFileObject', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SplFileObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation exportSubmissionsReviewsAsCsvAsync + * + * CSV Grades exports + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportSubmissionsReviewsAsCsv'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function exportSubmissionsReviewsAsCsvAsync( + string $class, + string $assignment, + string $contentType = self::contentTypes['exportSubmissionsReviewsAsCsv'][0] + ): PromiseInterface + { + return $this->exportSubmissionsReviewsAsCsvAsyncWithHttpInfo($class, $assignment, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation exportSubmissionsReviewsAsCsvAsyncWithHttpInfo + * + * CSV Grades exports + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportSubmissionsReviewsAsCsv'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function exportSubmissionsReviewsAsCsvAsyncWithHttpInfo( + string $class, + string $assignment, + string $contentType = self::contentTypes['exportSubmissionsReviewsAsCsv'][0] + ): PromiseInterface + { + $returnType = '\SplFileObject'; + $request = $this->exportSubmissionsReviewsAsCsvRequest($class, $assignment, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'exportSubmissionsReviewsAsCsv' + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportSubmissionsReviewsAsCsv'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function exportSubmissionsReviewsAsCsvRequest( + string $class, + string $assignment, + string $contentType = self::contentTypes['exportSubmissionsReviewsAsCsv'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling exportSubmissionsReviewsAsCsv' + ); + } + // verify the required parameter 'assignment' is set + if ($assignment === null || (is_array($assignment) && count($assignment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $assignment when calling exportSubmissionsReviewsAsCsv' + ); + } + + $resourcePath = '/classes/{class}/assignments/{assignment}/submissions/csv'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + // path params + if ($assignment !== null) { + $resourcePath = str_replace( + '{assignment}', + ObjectSerializer::toPathValue($assignment), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['text/csv', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation exportSubmissionsReviewsAsExcel + * + * Excel Grades exports + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportSubmissionsReviewsAsExcel'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \SplFileObject|\Flat\APIClient\Model\FlatErrorResponse + */ + public function exportSubmissionsReviewsAsExcel( + string $class, + string $assignment, + string $contentType = self::contentTypes['exportSubmissionsReviewsAsExcel'][0] + ): \SplFileObject|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->exportSubmissionsReviewsAsExcelWithHttpInfo($class, $assignment, $contentType); + return $response; + } + + /** + * Operation exportSubmissionsReviewsAsExcelWithHttpInfo + * + * Excel Grades exports + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportSubmissionsReviewsAsExcel'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \SplFileObject|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function exportSubmissionsReviewsAsExcelWithHttpInfo( + string $class, + string $assignment, + string $contentType = self::contentTypes['exportSubmissionsReviewsAsExcel'][0] + ): array + { + $request = $this->exportSubmissionsReviewsAsExcelRequest($class, $assignment, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\SplFileObject', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\SplFileObject', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SplFileObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation exportSubmissionsReviewsAsExcelAsync + * + * Excel Grades exports + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportSubmissionsReviewsAsExcel'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function exportSubmissionsReviewsAsExcelAsync( + string $class, + string $assignment, + string $contentType = self::contentTypes['exportSubmissionsReviewsAsExcel'][0] + ): PromiseInterface + { + return $this->exportSubmissionsReviewsAsExcelAsyncWithHttpInfo($class, $assignment, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation exportSubmissionsReviewsAsExcelAsyncWithHttpInfo + * + * Excel Grades exports + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportSubmissionsReviewsAsExcel'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function exportSubmissionsReviewsAsExcelAsyncWithHttpInfo( + string $class, + string $assignment, + string $contentType = self::contentTypes['exportSubmissionsReviewsAsExcel'][0] + ): PromiseInterface + { + $returnType = '\SplFileObject'; + $request = $this->exportSubmissionsReviewsAsExcelRequest($class, $assignment, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'exportSubmissionsReviewsAsExcel' + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportSubmissionsReviewsAsExcel'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function exportSubmissionsReviewsAsExcelRequest( + string $class, + string $assignment, + string $contentType = self::contentTypes['exportSubmissionsReviewsAsExcel'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling exportSubmissionsReviewsAsExcel' + ); + } + // verify the required parameter 'assignment' is set + if ($assignment === null || (is_array($assignment) && count($assignment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $assignment when calling exportSubmissionsReviewsAsExcel' + ); + } + + $resourcePath = '/classes/{class}/assignments/{assignment}/submissions/excel'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + // path params + if ($assignment !== null) { + $resourcePath = str_replace( + '{assignment}', + ObjectSerializer::toPathValue($assignment), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAssignment + * + * Get an assignment + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAssignment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\Assignment|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getAssignment( + string $class, + string $assignment, + string $contentType = self::contentTypes['getAssignment'][0] + ): \Flat\APIClient\Model\Assignment|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getAssignmentWithHttpInfo($class, $assignment, $contentType); + return $response; + } + + /** + * Operation getAssignmentWithHttpInfo + * + * Get an assignment + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAssignment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\Assignment|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getAssignmentWithHttpInfo( + string $class, + string $assignment, + string $contentType = self::contentTypes['getAssignment'][0] + ): array + { + $request = $this->getAssignmentRequest($class, $assignment, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Assignment', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Assignment', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\Assignment', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getAssignmentAsync + * + * Get an assignment + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getAssignmentAsync( + string $class, + string $assignment, + string $contentType = self::contentTypes['getAssignment'][0] + ): PromiseInterface + { + return $this->getAssignmentAsyncWithHttpInfo($class, $assignment, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAssignmentAsyncWithHttpInfo + * + * Get an assignment + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getAssignmentAsyncWithHttpInfo( + string $class, + string $assignment, + string $contentType = self::contentTypes['getAssignment'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\Assignment'; + $request = $this->getAssignmentRequest($class, $assignment, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAssignment' + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAssignmentRequest( + string $class, + string $assignment, + string $contentType = self::contentTypes['getAssignment'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling getAssignment' + ); + } + // verify the required parameter 'assignment' is set + if ($assignment === null || (is_array($assignment) && count($assignment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $assignment when calling getAssignment' + ); + } + + $resourcePath = '/classes/{class}/assignments/{assignment}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + // path params + if ($assignment !== null) { + $resourcePath = str_replace( + '{assignment}', + ObjectSerializer::toPathValue($assignment), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getClass + * + * Get the details of a single class + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getClass'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ClassDetails|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getClass( + string $class, + string $contentType = self::contentTypes['getClass'][0] + ): \Flat\APIClient\Model\ClassDetails|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getClassWithHttpInfo($class, $contentType); + return $response; + } + + /** + * Operation getClassWithHttpInfo + * + * Get the details of a single class + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getClass'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ClassDetails|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getClassWithHttpInfo( + string $class, + string $contentType = self::contentTypes['getClass'][0] + ): array + { + $request = $this->getClassRequest($class, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ClassDetails', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ClassDetails', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ClassDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getClassAsync + * + * Get the details of a single class + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getClassAsync( + string $class, + string $contentType = self::contentTypes['getClass'][0] + ): PromiseInterface + { + return $this->getClassAsyncWithHttpInfo($class, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getClassAsyncWithHttpInfo + * + * Get the details of a single class + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getClassAsyncWithHttpInfo( + string $class, + string $contentType = self::contentTypes['getClass'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ClassDetails'; + $request = $this->getClassRequest($class, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getClass' + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getClassRequest( + string $class, + string $contentType = self::contentTypes['getClass'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling getClass' + ); + } + + $resourcePath = '/classes/{class}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getScoreSubmissions + * + * List submissions related to the score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreSubmissions'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\AssignmentSubmission[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getScoreSubmissions( + string $score, + string $contentType = self::contentTypes['getScoreSubmissions'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getScoreSubmissionsWithHttpInfo($score, $contentType); + return $response; + } + + /** + * Operation getScoreSubmissionsWithHttpInfo + * + * List submissions related to the score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreSubmissions'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\AssignmentSubmission[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getScoreSubmissionsWithHttpInfo( + string $score, + string $contentType = self::contentTypes['getScoreSubmissions'][0] + ): array + { + $request = $this->getScoreSubmissionsRequest($score, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmission[]', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmission[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\AssignmentSubmission[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getScoreSubmissionsAsync + * + * List submissions related to the score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreSubmissions'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getScoreSubmissionsAsync( + string $score, + string $contentType = self::contentTypes['getScoreSubmissions'][0] + ): PromiseInterface + { + return $this->getScoreSubmissionsAsyncWithHttpInfo($score, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getScoreSubmissionsAsyncWithHttpInfo + * + * List submissions related to the score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreSubmissions'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getScoreSubmissionsAsyncWithHttpInfo( + string $score, + string $contentType = self::contentTypes['getScoreSubmissions'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\AssignmentSubmission[]'; + $request = $this->getScoreSubmissionsRequest($score, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getScoreSubmissions' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreSubmissions'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getScoreSubmissionsRequest( + string $score, + string $contentType = self::contentTypes['getScoreSubmissions'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling getScoreSubmissions' + ); + } + + $resourcePath = '/scores/{score}/submissions'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSubmission + * + * Get a student submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubmission'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\AssignmentSubmission|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getSubmission( + string $class, + string $assignment, + string $submission, + string $contentType = self::contentTypes['getSubmission'][0] + ): \Flat\APIClient\Model\AssignmentSubmission|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getSubmissionWithHttpInfo($class, $assignment, $submission, $contentType); + return $response; + } + + /** + * Operation getSubmissionWithHttpInfo + * + * Get a student submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubmission'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\AssignmentSubmission|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getSubmissionWithHttpInfo( + string $class, + string $assignment, + string $submission, + string $contentType = self::contentTypes['getSubmission'][0] + ): array + { + $request = $this->getSubmissionRequest($class, $assignment, $submission, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmission', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmission', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\AssignmentSubmission', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getSubmissionAsync + * + * Get a student submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubmission'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getSubmissionAsync( + string $class, + string $assignment, + string $submission, + string $contentType = self::contentTypes['getSubmission'][0] + ): PromiseInterface + { + return $this->getSubmissionAsyncWithHttpInfo($class, $assignment, $submission, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSubmissionAsyncWithHttpInfo + * + * Get a student submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubmission'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getSubmissionAsyncWithHttpInfo( + string $class, + string $assignment, + string $submission, + string $contentType = self::contentTypes['getSubmission'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\AssignmentSubmission'; + $request = $this->getSubmissionRequest($class, $assignment, $submission, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSubmission' + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubmission'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSubmissionRequest( + string $class, + string $assignment, + string $submission, + string $contentType = self::contentTypes['getSubmission'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling getSubmission' + ); + } + // verify the required parameter 'assignment' is set + if ($assignment === null || (is_array($assignment) && count($assignment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $assignment when calling getSubmission' + ); + } + // verify the required parameter 'submission' is set + if ($submission === null || (is_array($submission) && count($submission) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $submission when calling getSubmission' + ); + } + + $resourcePath = '/classes/{class}/assignments/{assignment}/submissions/{submission}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + // path params + if ($assignment !== null) { + $resourcePath = str_replace( + '{assignment}', + ObjectSerializer::toPathValue($assignment), + $resourcePath + ); + } + // path params + if ($submission !== null) { + $resourcePath = str_replace( + '{submission}', + ObjectSerializer::toPathValue($submission), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSubmissionComments + * + * List the feedback comments of a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubmissionComments'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\AssignmentSubmissionComment[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getSubmissionComments( + string $class, + string $assignment, + string $submission, + string $contentType = self::contentTypes['getSubmissionComments'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getSubmissionCommentsWithHttpInfo($class, $assignment, $submission, $contentType); + return $response; + } + + /** + * Operation getSubmissionCommentsWithHttpInfo + * + * List the feedback comments of a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubmissionComments'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\AssignmentSubmissionComment[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getSubmissionCommentsWithHttpInfo( + string $class, + string $assignment, + string $submission, + string $contentType = self::contentTypes['getSubmissionComments'][0] + ): array + { + $request = $this->getSubmissionCommentsRequest($class, $assignment, $submission, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmissionComment[]', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmissionComment[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\AssignmentSubmissionComment[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getSubmissionCommentsAsync + * + * List the feedback comments of a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubmissionComments'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getSubmissionCommentsAsync( + string $class, + string $assignment, + string $submission, + string $contentType = self::contentTypes['getSubmissionComments'][0] + ): PromiseInterface + { + return $this->getSubmissionCommentsAsyncWithHttpInfo($class, $assignment, $submission, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSubmissionCommentsAsyncWithHttpInfo + * + * List the feedback comments of a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubmissionComments'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getSubmissionCommentsAsyncWithHttpInfo( + string $class, + string $assignment, + string $submission, + string $contentType = self::contentTypes['getSubmissionComments'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\AssignmentSubmissionComment[]'; + $request = $this->getSubmissionCommentsRequest($class, $assignment, $submission, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSubmissionComments' + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubmissionComments'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSubmissionCommentsRequest( + string $class, + string $assignment, + string $submission, + string $contentType = self::contentTypes['getSubmissionComments'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling getSubmissionComments' + ); + } + // verify the required parameter 'assignment' is set + if ($assignment === null || (is_array($assignment) && count($assignment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $assignment when calling getSubmissionComments' + ); + } + // verify the required parameter 'submission' is set + if ($submission === null || (is_array($submission) && count($submission) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $submission when calling getSubmissionComments' + ); + } + + $resourcePath = '/classes/{class}/assignments/{assignment}/submissions/{submission}/comments'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + // path params + if ($assignment !== null) { + $resourcePath = str_replace( + '{assignment}', + ObjectSerializer::toPathValue($assignment), + $resourcePath + ); + } + // path params + if ($submission !== null) { + $resourcePath = str_replace( + '{submission}', + ObjectSerializer::toPathValue($submission), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSubmissionHistory + * + * Get the history of the submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubmissionHistory'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\AssignmentSubmissionHistory[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getSubmissionHistory( + string $class, + string $assignment, + string $submission, + string $contentType = self::contentTypes['getSubmissionHistory'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getSubmissionHistoryWithHttpInfo($class, $assignment, $submission, $contentType); + return $response; + } + + /** + * Operation getSubmissionHistoryWithHttpInfo + * + * Get the history of the submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubmissionHistory'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\AssignmentSubmissionHistory[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getSubmissionHistoryWithHttpInfo( + string $class, + string $assignment, + string $submission, + string $contentType = self::contentTypes['getSubmissionHistory'][0] + ): array + { + $request = $this->getSubmissionHistoryRequest($class, $assignment, $submission, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmissionHistory[]', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmissionHistory[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\AssignmentSubmissionHistory[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getSubmissionHistoryAsync + * + * Get the history of the submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubmissionHistory'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getSubmissionHistoryAsync( + string $class, + string $assignment, + string $submission, + string $contentType = self::contentTypes['getSubmissionHistory'][0] + ): PromiseInterface + { + return $this->getSubmissionHistoryAsyncWithHttpInfo($class, $assignment, $submission, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSubmissionHistoryAsyncWithHttpInfo + * + * Get the history of the submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubmissionHistory'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getSubmissionHistoryAsyncWithHttpInfo( + string $class, + string $assignment, + string $submission, + string $contentType = self::contentTypes['getSubmissionHistory'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\AssignmentSubmissionHistory[]'; + $request = $this->getSubmissionHistoryRequest($class, $assignment, $submission, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSubmissionHistory' + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubmissionHistory'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSubmissionHistoryRequest( + string $class, + string $assignment, + string $submission, + string $contentType = self::contentTypes['getSubmissionHistory'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling getSubmissionHistory' + ); + } + // verify the required parameter 'assignment' is set + if ($assignment === null || (is_array($assignment) && count($assignment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $assignment when calling getSubmissionHistory' + ); + } + // verify the required parameter 'submission' is set + if ($submission === null || (is_array($submission) && count($submission) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $submission when calling getSubmissionHistory' + ); + } + + $resourcePath = '/classes/{class}/assignments/{assignment}/submissions/{submission}/history'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + // path params + if ($assignment !== null) { + $resourcePath = str_replace( + '{assignment}', + ObjectSerializer::toPathValue($assignment), + $resourcePath + ); + } + // path params + if ($submission !== null) { + $resourcePath = str_replace( + '{submission}', + ObjectSerializer::toPathValue($submission), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSubmissions + * + * List the students' submissions + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubmissions'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\AssignmentSubmission[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getSubmissions( + string $class, + string $assignment, + string $contentType = self::contentTypes['getSubmissions'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getSubmissionsWithHttpInfo($class, $assignment, $contentType); + return $response; + } + + /** + * Operation getSubmissionsWithHttpInfo + * + * List the students' submissions + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubmissions'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\AssignmentSubmission[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getSubmissionsWithHttpInfo( + string $class, + string $assignment, + string $contentType = self::contentTypes['getSubmissions'][0] + ): array + { + $request = $this->getSubmissionsRequest($class, $assignment, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmission[]', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmission[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\AssignmentSubmission[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getSubmissionsAsync + * + * List the students' submissions + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubmissions'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getSubmissionsAsync( + string $class, + string $assignment, + string $contentType = self::contentTypes['getSubmissions'][0] + ): PromiseInterface + { + return $this->getSubmissionsAsyncWithHttpInfo($class, $assignment, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSubmissionsAsyncWithHttpInfo + * + * List the students' submissions + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubmissions'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getSubmissionsAsyncWithHttpInfo( + string $class, + string $assignment, + string $contentType = self::contentTypes['getSubmissions'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\AssignmentSubmission[]'; + $request = $this->getSubmissionsRequest($class, $assignment, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSubmissions' + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubmissions'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSubmissionsRequest( + string $class, + string $assignment, + string $contentType = self::contentTypes['getSubmissions'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling getSubmissions' + ); + } + // verify the required parameter 'assignment' is set + if ($assignment === null || (is_array($assignment) && count($assignment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $assignment when calling getSubmissions' + ); + } + + $resourcePath = '/classes/{class}/assignments/{assignment}/submissions'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + // path params + if ($assignment !== null) { + $resourcePath = str_replace( + '{assignment}', + ObjectSerializer::toPathValue($assignment), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listAssignments + * + * Assignments listing + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAssignments'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ClassAssignment[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function listAssignments( + string $class, + string $contentType = self::contentTypes['listAssignments'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->listAssignmentsWithHttpInfo($class, $contentType); + return $response; + } + + /** + * Operation listAssignmentsWithHttpInfo + * + * Assignments listing + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAssignments'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ClassAssignment[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listAssignmentsWithHttpInfo( + string $class, + string $contentType = self::contentTypes['listAssignments'][0] + ): array + { + $request = $this->listAssignmentsRequest($class, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ClassAssignment[]', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ClassAssignment[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ClassAssignment[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listAssignmentsAsync + * + * Assignments listing + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAssignments'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listAssignmentsAsync( + string $class, + string $contentType = self::contentTypes['listAssignments'][0] + ): PromiseInterface + { + return $this->listAssignmentsAsyncWithHttpInfo($class, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listAssignmentsAsyncWithHttpInfo + * + * Assignments listing + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAssignments'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listAssignmentsAsyncWithHttpInfo( + string $class, + string $contentType = self::contentTypes['listAssignments'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ClassAssignment[]'; + $request = $this->listAssignmentsRequest($class, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listAssignments' + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAssignments'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listAssignmentsRequest( + string $class, + string $contentType = self::contentTypes['listAssignments'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling listAssignments' + ); + } + + $resourcePath = '/classes/{class}/assignments'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listClassStudentSubmissions + * + * List the submissions for a student + * + * @param string $class Unique identifier of the class (required) + * @param string $user Unique identifier of the user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listClassStudentSubmissions'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\AssignmentSubmission[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function listClassStudentSubmissions( + string $class, + string $user, + string $contentType = self::contentTypes['listClassStudentSubmissions'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->listClassStudentSubmissionsWithHttpInfo($class, $user, $contentType); + return $response; + } + + /** + * Operation listClassStudentSubmissionsWithHttpInfo + * + * List the submissions for a student + * + * @param string $class Unique identifier of the class (required) + * @param string $user Unique identifier of the user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listClassStudentSubmissions'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\AssignmentSubmission[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listClassStudentSubmissionsWithHttpInfo( + string $class, + string $user, + string $contentType = self::contentTypes['listClassStudentSubmissions'][0] + ): array + { + $request = $this->listClassStudentSubmissionsRequest($class, $user, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmission[]', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmission[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\AssignmentSubmission[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listClassStudentSubmissionsAsync + * + * List the submissions for a student + * + * @param string $class Unique identifier of the class (required) + * @param string $user Unique identifier of the user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listClassStudentSubmissions'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listClassStudentSubmissionsAsync( + string $class, + string $user, + string $contentType = self::contentTypes['listClassStudentSubmissions'][0] + ): PromiseInterface + { + return $this->listClassStudentSubmissionsAsyncWithHttpInfo($class, $user, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listClassStudentSubmissionsAsyncWithHttpInfo + * + * List the submissions for a student + * + * @param string $class Unique identifier of the class (required) + * @param string $user Unique identifier of the user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listClassStudentSubmissions'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listClassStudentSubmissionsAsyncWithHttpInfo( + string $class, + string $user, + string $contentType = self::contentTypes['listClassStudentSubmissions'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\AssignmentSubmission[]'; + $request = $this->listClassStudentSubmissionsRequest($class, $user, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listClassStudentSubmissions' + * + * @param string $class Unique identifier of the class (required) + * @param string $user Unique identifier of the user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listClassStudentSubmissions'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listClassStudentSubmissionsRequest( + string $class, + string $user, + string $contentType = self::contentTypes['listClassStudentSubmissions'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling listClassStudentSubmissions' + ); + } + // verify the required parameter 'user' is set + if ($user === null || (is_array($user) && count($user) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $user when calling listClassStudentSubmissions' + ); + } + + $resourcePath = '/classes/{class}/students/{user}/submissions'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + // path params + if ($user !== null) { + $resourcePath = str_replace( + '{user}', + ObjectSerializer::toPathValue($user), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listClasses + * + * List the classes available for the current user + * + * @param string|null $state Filter the classes by state (optional, default to 'active') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listClasses'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ClassDetails[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function listClasses( + ?string $state = 'active', + string $contentType = self::contentTypes['listClasses'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->listClassesWithHttpInfo($state, $contentType); + return $response; + } + + /** + * Operation listClassesWithHttpInfo + * + * List the classes available for the current user + * + * @param string|null $state Filter the classes by state (optional, default to 'active') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listClasses'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ClassDetails[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listClassesWithHttpInfo( + ?string $state = 'active', + string $contentType = self::contentTypes['listClasses'][0] + ): array + { + $request = $this->listClassesRequest($state, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ClassDetails[]', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ClassDetails[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ClassDetails[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listClassesAsync + * + * List the classes available for the current user + * + * @param string|null $state Filter the classes by state (optional, default to 'active') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listClasses'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listClassesAsync( + ?string $state = 'active', + string $contentType = self::contentTypes['listClasses'][0] + ): PromiseInterface + { + return $this->listClassesAsyncWithHttpInfo($state, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listClassesAsyncWithHttpInfo + * + * List the classes available for the current user + * + * @param string|null $state Filter the classes by state (optional, default to 'active') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listClasses'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listClassesAsyncWithHttpInfo( + ?string $state = 'active', + string $contentType = self::contentTypes['listClasses'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ClassDetails[]'; + $request = $this->listClassesRequest($state, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listClasses' + * + * @param string|null $state Filter the classes by state (optional, default to 'active') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listClasses'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listClassesRequest( + ?string $state = 'active', + string $contentType = self::contentTypes['listClasses'][0] + ): Request + { + + $resourcePath = '/classes'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $state, + 'state', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation postSubmissionComment + * + * Add a feedback comment to a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param \Flat\APIClient\Model\AssignmentSubmissionCommentCreation $assignment_submission_comment_creation assignment_submission_comment_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postSubmissionComment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\AssignmentSubmissionComment|\Flat\APIClient\Model\FlatErrorResponse + */ + public function postSubmissionComment( + string $class, + string $assignment, + string $submission, + \Flat\APIClient\Model\AssignmentSubmissionCommentCreation $assignment_submission_comment_creation, + string $contentType = self::contentTypes['postSubmissionComment'][0] + ): \Flat\APIClient\Model\AssignmentSubmissionComment|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->postSubmissionCommentWithHttpInfo($class, $assignment, $submission, $assignment_submission_comment_creation, $contentType); + return $response; + } + + /** + * Operation postSubmissionCommentWithHttpInfo + * + * Add a feedback comment to a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param \Flat\APIClient\Model\AssignmentSubmissionCommentCreation $assignment_submission_comment_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postSubmissionComment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\AssignmentSubmissionComment|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function postSubmissionCommentWithHttpInfo( + string $class, + string $assignment, + string $submission, + \Flat\APIClient\Model\AssignmentSubmissionCommentCreation $assignment_submission_comment_creation, + string $contentType = self::contentTypes['postSubmissionComment'][0] + ): array + { + $request = $this->postSubmissionCommentRequest($class, $assignment, $submission, $assignment_submission_comment_creation, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmissionComment', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmissionComment', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\AssignmentSubmissionComment', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation postSubmissionCommentAsync + * + * Add a feedback comment to a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param \Flat\APIClient\Model\AssignmentSubmissionCommentCreation $assignment_submission_comment_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postSubmissionComment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function postSubmissionCommentAsync( + string $class, + string $assignment, + string $submission, + \Flat\APIClient\Model\AssignmentSubmissionCommentCreation $assignment_submission_comment_creation, + string $contentType = self::contentTypes['postSubmissionComment'][0] + ): PromiseInterface + { + return $this->postSubmissionCommentAsyncWithHttpInfo($class, $assignment, $submission, $assignment_submission_comment_creation, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation postSubmissionCommentAsyncWithHttpInfo + * + * Add a feedback comment to a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param \Flat\APIClient\Model\AssignmentSubmissionCommentCreation $assignment_submission_comment_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postSubmissionComment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function postSubmissionCommentAsyncWithHttpInfo( + string $class, + string $assignment, + string $submission, + \Flat\APIClient\Model\AssignmentSubmissionCommentCreation $assignment_submission_comment_creation, + string $contentType = self::contentTypes['postSubmissionComment'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\AssignmentSubmissionComment'; + $request = $this->postSubmissionCommentRequest($class, $assignment, $submission, $assignment_submission_comment_creation, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'postSubmissionComment' + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param \Flat\APIClient\Model\AssignmentSubmissionCommentCreation $assignment_submission_comment_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postSubmissionComment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function postSubmissionCommentRequest( + string $class, + string $assignment, + string $submission, + \Flat\APIClient\Model\AssignmentSubmissionCommentCreation $assignment_submission_comment_creation, + string $contentType = self::contentTypes['postSubmissionComment'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling postSubmissionComment' + ); + } + // verify the required parameter 'assignment' is set + if ($assignment === null || (is_array($assignment) && count($assignment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $assignment when calling postSubmissionComment' + ); + } + // verify the required parameter 'submission' is set + if ($submission === null || (is_array($submission) && count($submission) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $submission when calling postSubmissionComment' + ); + } + // verify the required parameter 'assignment_submission_comment_creation' is set + if ($assignment_submission_comment_creation === null || (is_array($assignment_submission_comment_creation) && count($assignment_submission_comment_creation) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $assignment_submission_comment_creation when calling postSubmissionComment' + ); + } + + $resourcePath = '/classes/{class}/assignments/{assignment}/submissions/{submission}/comments'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + // path params + if ($assignment !== null) { + $resourcePath = str_replace( + '{assignment}', + ObjectSerializer::toPathValue($assignment), + $resourcePath + ); + } + // path params + if ($submission !== null) { + $resourcePath = str_replace( + '{submission}', + ObjectSerializer::toPathValue($submission), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($assignment_submission_comment_creation)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($assignment_submission_comment_creation)); + } else { + $httpBody = $assignment_submission_comment_creation; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation unarchiveAssignment + * + * Unarchive the assignment. + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unarchiveAssignment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\Assignment|\Flat\APIClient\Model\FlatErrorResponse + */ + public function unarchiveAssignment( + string $class, + string $assignment, + string $contentType = self::contentTypes['unarchiveAssignment'][0] + ): \Flat\APIClient\Model\Assignment|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->unarchiveAssignmentWithHttpInfo($class, $assignment, $contentType); + return $response; + } + + /** + * Operation unarchiveAssignmentWithHttpInfo + * + * Unarchive the assignment. + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unarchiveAssignment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\Assignment|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function unarchiveAssignmentWithHttpInfo( + string $class, + string $assignment, + string $contentType = self::contentTypes['unarchiveAssignment'][0] + ): array + { + $request = $this->unarchiveAssignmentRequest($class, $assignment, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Assignment', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Assignment', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\Assignment', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation unarchiveAssignmentAsync + * + * Unarchive the assignment. + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unarchiveAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function unarchiveAssignmentAsync( + string $class, + string $assignment, + string $contentType = self::contentTypes['unarchiveAssignment'][0] + ): PromiseInterface + { + return $this->unarchiveAssignmentAsyncWithHttpInfo($class, $assignment, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation unarchiveAssignmentAsyncWithHttpInfo + * + * Unarchive the assignment. + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unarchiveAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function unarchiveAssignmentAsyncWithHttpInfo( + string $class, + string $assignment, + string $contentType = self::contentTypes['unarchiveAssignment'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\Assignment'; + $request = $this->unarchiveAssignmentRequest($class, $assignment, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'unarchiveAssignment' + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unarchiveAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function unarchiveAssignmentRequest( + string $class, + string $assignment, + string $contentType = self::contentTypes['unarchiveAssignment'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling unarchiveAssignment' + ); + } + // verify the required parameter 'assignment' is set + if ($assignment === null || (is_array($assignment) && count($assignment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $assignment when calling unarchiveAssignment' + ); + } + + $resourcePath = '/classes/{class}/assignments/{assignment}/archive'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + // path params + if ($assignment !== null) { + $resourcePath = str_replace( + '{assignment}', + ObjectSerializer::toPathValue($assignment), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation unarchiveClass + * + * Unarchive the class + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unarchiveClass'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ClassDetails|\Flat\APIClient\Model\FlatErrorResponse + */ + public function unarchiveClass( + string $class, + string $contentType = self::contentTypes['unarchiveClass'][0] + ): \Flat\APIClient\Model\ClassDetails|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->unarchiveClassWithHttpInfo($class, $contentType); + return $response; + } + + /** + * Operation unarchiveClassWithHttpInfo + * + * Unarchive the class + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unarchiveClass'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ClassDetails|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function unarchiveClassWithHttpInfo( + string $class, + string $contentType = self::contentTypes['unarchiveClass'][0] + ): array + { + $request = $this->unarchiveClassRequest($class, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ClassDetails', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ClassDetails', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ClassDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation unarchiveClassAsync + * + * Unarchive the class + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unarchiveClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function unarchiveClassAsync( + string $class, + string $contentType = self::contentTypes['unarchiveClass'][0] + ): PromiseInterface + { + return $this->unarchiveClassAsyncWithHttpInfo($class, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation unarchiveClassAsyncWithHttpInfo + * + * Unarchive the class + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unarchiveClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function unarchiveClassAsyncWithHttpInfo( + string $class, + string $contentType = self::contentTypes['unarchiveClass'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ClassDetails'; + $request = $this->unarchiveClassRequest($class, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'unarchiveClass' + * + * @param string $class Unique identifier of the class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unarchiveClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function unarchiveClassRequest( + string $class, + string $contentType = self::contentTypes['unarchiveClass'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling unarchiveClass' + ); + } + + $resourcePath = '/classes/{class}/archive'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateClass + * + * Update the class + * + * @param string $class Unique identifier of the class (required) + * @param \Flat\APIClient\Model\ClassUpdate $body Details of the Class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateClass'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ClassDetails|\Flat\APIClient\Model\FlatErrorResponse + */ + public function updateClass( + string $class, + \Flat\APIClient\Model\ClassUpdate $body, + string $contentType = self::contentTypes['updateClass'][0] + ): \Flat\APIClient\Model\ClassDetails|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->updateClassWithHttpInfo($class, $body, $contentType); + return $response; + } + + /** + * Operation updateClassWithHttpInfo + * + * Update the class + * + * @param string $class Unique identifier of the class (required) + * @param \Flat\APIClient\Model\ClassUpdate $body Details of the Class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateClass'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ClassDetails|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function updateClassWithHttpInfo( + string $class, + \Flat\APIClient\Model\ClassUpdate $body, + string $contentType = self::contentTypes['updateClass'][0] + ): array + { + $request = $this->updateClassRequest($class, $body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ClassDetails', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ClassDetails', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ClassDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation updateClassAsync + * + * Update the class + * + * @param string $class Unique identifier of the class (required) + * @param \Flat\APIClient\Model\ClassUpdate $body Details of the Class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateClassAsync( + string $class, + \Flat\APIClient\Model\ClassUpdate $body, + string $contentType = self::contentTypes['updateClass'][0] + ): PromiseInterface + { + return $this->updateClassAsyncWithHttpInfo($class, $body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateClassAsyncWithHttpInfo + * + * Update the class + * + * @param string $class Unique identifier of the class (required) + * @param \Flat\APIClient\Model\ClassUpdate $body Details of the Class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateClassAsyncWithHttpInfo( + string $class, + \Flat\APIClient\Model\ClassUpdate $body, + string $contentType = self::contentTypes['updateClass'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ClassDetails'; + $request = $this->updateClassRequest($class, $body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateClass' + * + * @param string $class Unique identifier of the class (required) + * @param \Flat\APIClient\Model\ClassUpdate $body Details of the Class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateClassRequest( + string $class, + \Flat\APIClient\Model\ClassUpdate $body, + string $contentType = self::contentTypes['updateClass'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling updateClass' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling updateClass' + ); + } + + $resourcePath = '/classes/{class}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateClassAssignment + * + * Update an assignment + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param \Flat\APIClient\Model\ClassAssignmentUpdate $body body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateClassAssignment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\Assignment|\Flat\APIClient\Model\FlatErrorResponse + */ + public function updateClassAssignment( + string $class, + string $assignment, + \Flat\APIClient\Model\ClassAssignmentUpdate $body, + string $contentType = self::contentTypes['updateClassAssignment'][0] + ): \Flat\APIClient\Model\Assignment|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->updateClassAssignmentWithHttpInfo($class, $assignment, $body, $contentType); + return $response; + } + + /** + * Operation updateClassAssignmentWithHttpInfo + * + * Update an assignment + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param \Flat\APIClient\Model\ClassAssignmentUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateClassAssignment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\Assignment|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function updateClassAssignmentWithHttpInfo( + string $class, + string $assignment, + \Flat\APIClient\Model\ClassAssignmentUpdate $body, + string $contentType = self::contentTypes['updateClassAssignment'][0] + ): array + { + $request = $this->updateClassAssignmentRequest($class, $assignment, $body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Assignment', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Assignment', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\Assignment', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation updateClassAssignmentAsync + * + * Update an assignment + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param \Flat\APIClient\Model\ClassAssignmentUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateClassAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateClassAssignmentAsync( + string $class, + string $assignment, + \Flat\APIClient\Model\ClassAssignmentUpdate $body, + string $contentType = self::contentTypes['updateClassAssignment'][0] + ): PromiseInterface + { + return $this->updateClassAssignmentAsyncWithHttpInfo($class, $assignment, $body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateClassAssignmentAsyncWithHttpInfo + * + * Update an assignment + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param \Flat\APIClient\Model\ClassAssignmentUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateClassAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateClassAssignmentAsyncWithHttpInfo( + string $class, + string $assignment, + \Flat\APIClient\Model\ClassAssignmentUpdate $body, + string $contentType = self::contentTypes['updateClassAssignment'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\Assignment'; + $request = $this->updateClassAssignmentRequest($class, $assignment, $body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateClassAssignment' + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param \Flat\APIClient\Model\ClassAssignmentUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateClassAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateClassAssignmentRequest( + string $class, + string $assignment, + \Flat\APIClient\Model\ClassAssignmentUpdate $body, + string $contentType = self::contentTypes['updateClassAssignment'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling updateClassAssignment' + ); + } + // verify the required parameter 'assignment' is set + if ($assignment === null || (is_array($assignment) && count($assignment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $assignment when calling updateClassAssignment' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling updateClassAssignment' + ); + } + + $resourcePath = '/classes/{class}/assignments/{assignment}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + // path params + if ($assignment !== null) { + $resourcePath = str_replace( + '{assignment}', + ObjectSerializer::toPathValue($assignment), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateSubmissionComment + * + * Update a feedback comment to a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $comment Unique identifier of the comment (required) + * @param \Flat\APIClient\Model\AssignmentSubmissionCommentCreation $assignment_submission_comment_creation assignment_submission_comment_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSubmissionComment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\AssignmentSubmissionComment|\Flat\APIClient\Model\FlatErrorResponse + */ + public function updateSubmissionComment( + string $class, + string $assignment, + string $submission, + string $comment, + \Flat\APIClient\Model\AssignmentSubmissionCommentCreation $assignment_submission_comment_creation, + string $contentType = self::contentTypes['updateSubmissionComment'][0] + ): \Flat\APIClient\Model\AssignmentSubmissionComment|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->updateSubmissionCommentWithHttpInfo($class, $assignment, $submission, $comment, $assignment_submission_comment_creation, $contentType); + return $response; + } + + /** + * Operation updateSubmissionCommentWithHttpInfo + * + * Update a feedback comment to a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $comment Unique identifier of the comment (required) + * @param \Flat\APIClient\Model\AssignmentSubmissionCommentCreation $assignment_submission_comment_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSubmissionComment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\AssignmentSubmissionComment|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function updateSubmissionCommentWithHttpInfo( + string $class, + string $assignment, + string $submission, + string $comment, + \Flat\APIClient\Model\AssignmentSubmissionCommentCreation $assignment_submission_comment_creation, + string $contentType = self::contentTypes['updateSubmissionComment'][0] + ): array + { + $request = $this->updateSubmissionCommentRequest($class, $assignment, $submission, $comment, $assignment_submission_comment_creation, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmissionComment', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmissionComment', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\AssignmentSubmissionComment', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation updateSubmissionCommentAsync + * + * Update a feedback comment to a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $comment Unique identifier of the comment (required) + * @param \Flat\APIClient\Model\AssignmentSubmissionCommentCreation $assignment_submission_comment_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSubmissionComment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateSubmissionCommentAsync( + string $class, + string $assignment, + string $submission, + string $comment, + \Flat\APIClient\Model\AssignmentSubmissionCommentCreation $assignment_submission_comment_creation, + string $contentType = self::contentTypes['updateSubmissionComment'][0] + ): PromiseInterface + { + return $this->updateSubmissionCommentAsyncWithHttpInfo($class, $assignment, $submission, $comment, $assignment_submission_comment_creation, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateSubmissionCommentAsyncWithHttpInfo + * + * Update a feedback comment to a submission + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $comment Unique identifier of the comment (required) + * @param \Flat\APIClient\Model\AssignmentSubmissionCommentCreation $assignment_submission_comment_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSubmissionComment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateSubmissionCommentAsyncWithHttpInfo( + string $class, + string $assignment, + string $submission, + string $comment, + \Flat\APIClient\Model\AssignmentSubmissionCommentCreation $assignment_submission_comment_creation, + string $contentType = self::contentTypes['updateSubmissionComment'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\AssignmentSubmissionComment'; + $request = $this->updateSubmissionCommentRequest($class, $assignment, $submission, $comment, $assignment_submission_comment_creation, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateSubmissionComment' + * + * @param string $class Unique identifier of the class (required) + * @param string $assignment Unique identifier of the assignment (required) + * @param string $submission Unique identifier of the submission (required) + * @param string $comment Unique identifier of the comment (required) + * @param \Flat\APIClient\Model\AssignmentSubmissionCommentCreation $assignment_submission_comment_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSubmissionComment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateSubmissionCommentRequest( + string $class, + string $assignment, + string $submission, + string $comment, + \Flat\APIClient\Model\AssignmentSubmissionCommentCreation $assignment_submission_comment_creation, + string $contentType = self::contentTypes['updateSubmissionComment'][0] + ): Request + { + // verify the required parameter 'class' is set + if ($class === null || (is_array($class) && count($class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $class when calling updateSubmissionComment' + ); + } + // verify the required parameter 'assignment' is set + if ($assignment === null || (is_array($assignment) && count($assignment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $assignment when calling updateSubmissionComment' + ); + } + // verify the required parameter 'submission' is set + if ($submission === null || (is_array($submission) && count($submission) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $submission when calling updateSubmissionComment' + ); + } + // verify the required parameter 'comment' is set + if ($comment === null || (is_array($comment) && count($comment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $comment when calling updateSubmissionComment' + ); + } + // verify the required parameter 'assignment_submission_comment_creation' is set + if ($assignment_submission_comment_creation === null || (is_array($assignment_submission_comment_creation) && count($assignment_submission_comment_creation) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $assignment_submission_comment_creation when calling updateSubmissionComment' + ); + } + + $resourcePath = '/classes/{class}/assignments/{assignment}/submissions/{submission}/comments/{comment}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($class !== null) { + $resourcePath = str_replace( + '{class}', + ObjectSerializer::toPathValue($class), + $resourcePath + ); + } + // path params + if ($assignment !== null) { + $resourcePath = str_replace( + '{assignment}', + ObjectSerializer::toPathValue($assignment), + $resourcePath + ); + } + // path params + if ($submission !== null) { + $resourcePath = str_replace( + '{submission}', + ObjectSerializer::toPathValue($submission), + $resourcePath + ); + } + // path params + if ($comment !== null) { + $resourcePath = str_replace( + '{comment}', + ObjectSerializer::toPathValue($comment), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($assignment_submission_comment_creation)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($assignment_submission_comment_creation)); + } else { + $httpBody = $assignment_submission_comment_creation; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/src/Api/CollectionApi.php b/src/Api/CollectionApi.php new file mode 100644 index 0000000..d64ea0c --- /dev/null +++ b/src/Api/CollectionApi.php @@ -0,0 +1,3085 @@ + $contentTypes **/ + public const contentTypes = [ + 'addScoreToCollection' => [ + 'application/x-www-form-urlencoded', + ], + 'createCollection' => [ + 'application/json', + ], + 'deleteCollection' => [ + 'application/json', + ], + 'deleteScoreFromCollection' => [ + 'application/x-www-form-urlencoded', + ], + 'editCollection' => [ + 'application/json', + ], + 'getCollection' => [ + 'application/json', + ], + 'listCollectionScores' => [ + 'application/json', + ], + 'listCollections' => [ + 'application/json', + ], + 'untrashCollection' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation addScoreToCollection + * + * Add a score to the collection + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted (required) + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addScoreToCollection'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ScoreDetails|\Flat\APIClient\Model\FlatErrorResponse + */ + public function addScoreToCollection( + string $collection, + string $score, + ?string $sharing_key = null, + string $contentType = self::contentTypes['addScoreToCollection'][0] + ): \Flat\APIClient\Model\ScoreDetails|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->addScoreToCollectionWithHttpInfo($collection, $score, $sharing_key, $contentType); + return $response; + } + + /** + * Operation addScoreToCollectionWithHttpInfo + * + * Add a score to the collection + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted (required) + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addScoreToCollection'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ScoreDetails|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function addScoreToCollectionWithHttpInfo( + string $collection, + string $score, + ?string $sharing_key = null, + string $contentType = self::contentTypes['addScoreToCollection'][0] + ): array + { + $request = $this->addScoreToCollectionRequest($collection, $score, $sharing_key, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ScoreDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation addScoreToCollectionAsync + * + * Add a score to the collection + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted (required) + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addScoreToCollection'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function addScoreToCollectionAsync( + string $collection, + string $score, + ?string $sharing_key = null, + string $contentType = self::contentTypes['addScoreToCollection'][0] + ): PromiseInterface + { + return $this->addScoreToCollectionAsyncWithHttpInfo($collection, $score, $sharing_key, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addScoreToCollectionAsyncWithHttpInfo + * + * Add a score to the collection + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted (required) + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addScoreToCollection'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function addScoreToCollectionAsyncWithHttpInfo( + string $collection, + string $score, + ?string $sharing_key = null, + string $contentType = self::contentTypes['addScoreToCollection'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ScoreDetails'; + $request = $this->addScoreToCollectionRequest($collection, $score, $sharing_key, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'addScoreToCollection' + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted (required) + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addScoreToCollection'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function addScoreToCollectionRequest( + string $collection, + string $score, + ?string $sharing_key = null, + string $contentType = self::contentTypes['addScoreToCollection'][0] + ): Request + { + // verify the required parameter 'collection' is set + if ($collection === null || (is_array($collection) && count($collection) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $collection when calling addScoreToCollection' + ); + } + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling addScoreToCollection' + ); + } + + $resourcePath = '/collections/{collection}/scores/{score}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sharing_key, + 'sharingKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($collection !== null) { + $resourcePath = str_replace( + '{collection}', + ObjectSerializer::toPathValue($collection), + $resourcePath + ); + } + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createCollection + * + * Create a new collection + * + * @param \Flat\APIClient\Model\CollectionCreation $body body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCollection'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\Collection|\Flat\APIClient\Model\FlatErrorResponse + */ + public function createCollection( + \Flat\APIClient\Model\CollectionCreation $body, + string $contentType = self::contentTypes['createCollection'][0] + ): \Flat\APIClient\Model\Collection|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->createCollectionWithHttpInfo($body, $contentType); + return $response; + } + + /** + * Operation createCollectionWithHttpInfo + * + * Create a new collection + * + * @param \Flat\APIClient\Model\CollectionCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCollection'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\Collection|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createCollectionWithHttpInfo( + \Flat\APIClient\Model\CollectionCreation $body, + string $contentType = self::contentTypes['createCollection'][0] + ): array + { + $request = $this->createCollectionRequest($body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Collection', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Collection', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\Collection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createCollectionAsync + * + * Create a new collection + * + * @param \Flat\APIClient\Model\CollectionCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCollection'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createCollectionAsync( + \Flat\APIClient\Model\CollectionCreation $body, + string $contentType = self::contentTypes['createCollection'][0] + ): PromiseInterface + { + return $this->createCollectionAsyncWithHttpInfo($body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createCollectionAsyncWithHttpInfo + * + * Create a new collection + * + * @param \Flat\APIClient\Model\CollectionCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCollection'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createCollectionAsyncWithHttpInfo( + \Flat\APIClient\Model\CollectionCreation $body, + string $contentType = self::contentTypes['createCollection'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\Collection'; + $request = $this->createCollectionRequest($body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createCollection' + * + * @param \Flat\APIClient\Model\CollectionCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCollection'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createCollectionRequest( + \Flat\APIClient\Model\CollectionCreation $body, + string $contentType = self::contentTypes['createCollection'][0] + ): Request + { + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling createCollection' + ); + } + + $resourcePath = '/collections'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteCollection + * + * Delete the collection + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteCollection'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\FlatErrorResponse|null + */ + public function deleteCollection( + string $collection, + string $contentType = self::contentTypes['deleteCollection'][0] + ): ?\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->deleteCollectionWithHttpInfo($collection, $contentType); + return $response; + } + + /** + * Operation deleteCollectionWithHttpInfo + * + * Delete the collection + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteCollection'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function deleteCollectionWithHttpInfo( + string $collection, + string $contentType = self::contentTypes['deleteCollection'][0] + ): array + { + $request = $this->deleteCollectionRequest($collection, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation deleteCollectionAsync + * + * Delete the collection + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteCollection'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteCollectionAsync( + string $collection, + string $contentType = self::contentTypes['deleteCollection'][0] + ): PromiseInterface + { + return $this->deleteCollectionAsyncWithHttpInfo($collection, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteCollectionAsyncWithHttpInfo + * + * Delete the collection + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteCollection'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteCollectionAsyncWithHttpInfo( + string $collection, + string $contentType = self::contentTypes['deleteCollection'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deleteCollectionRequest($collection, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteCollection' + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteCollection'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteCollectionRequest( + string $collection, + string $contentType = self::contentTypes['deleteCollection'][0] + ): Request + { + // verify the required parameter 'collection' is set + if ($collection === null || (is_array($collection) && count($collection) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $collection when calling deleteCollection' + ); + } + + $resourcePath = '/collections/{collection}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($collection !== null) { + $resourcePath = str_replace( + '{collection}', + ObjectSerializer::toPathValue($collection), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteScoreFromCollection + * + * Delete a score from the collection + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted (required) + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $event_properties Optional analytics properties merged into XP tracking for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` (optional) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScoreFromCollection'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\FlatErrorResponse|null + */ + public function deleteScoreFromCollection( + string $collection, + string $score, + ?string $event_properties = null, + ?string $sharing_key = null, + string $contentType = self::contentTypes['deleteScoreFromCollection'][0] + ): ?\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->deleteScoreFromCollectionWithHttpInfo($collection, $score, $event_properties, $sharing_key, $contentType); + return $response; + } + + /** + * Operation deleteScoreFromCollectionWithHttpInfo + * + * Delete a score from the collection + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted (required) + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $event_properties Optional analytics properties merged into XP tracking for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` (optional) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScoreFromCollection'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function deleteScoreFromCollectionWithHttpInfo( + string $collection, + string $score, + ?string $event_properties = null, + ?string $sharing_key = null, + string $contentType = self::contentTypes['deleteScoreFromCollection'][0] + ): array + { + $request = $this->deleteScoreFromCollectionRequest($collection, $score, $event_properties, $sharing_key, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation deleteScoreFromCollectionAsync + * + * Delete a score from the collection + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted (required) + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $event_properties Optional analytics properties merged into XP tracking for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` (optional) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScoreFromCollection'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteScoreFromCollectionAsync( + string $collection, + string $score, + ?string $event_properties = null, + ?string $sharing_key = null, + string $contentType = self::contentTypes['deleteScoreFromCollection'][0] + ): PromiseInterface + { + return $this->deleteScoreFromCollectionAsyncWithHttpInfo($collection, $score, $event_properties, $sharing_key, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteScoreFromCollectionAsyncWithHttpInfo + * + * Delete a score from the collection + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted (required) + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $event_properties Optional analytics properties merged into XP tracking for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` (optional) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScoreFromCollection'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteScoreFromCollectionAsyncWithHttpInfo( + string $collection, + string $score, + ?string $event_properties = null, + ?string $sharing_key = null, + string $contentType = self::contentTypes['deleteScoreFromCollection'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deleteScoreFromCollectionRequest($collection, $score, $event_properties, $sharing_key, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteScoreFromCollection' + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted (required) + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $event_properties Optional analytics properties merged into XP tracking for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` (optional) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScoreFromCollection'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteScoreFromCollectionRequest( + string $collection, + string $score, + ?string $event_properties = null, + ?string $sharing_key = null, + string $contentType = self::contentTypes['deleteScoreFromCollection'][0] + ): Request + { + // verify the required parameter 'collection' is set + if ($collection === null || (is_array($collection) && count($collection) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $collection when calling deleteScoreFromCollection' + ); + } + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling deleteScoreFromCollection' + ); + } + + $resourcePath = '/collections/{collection}/scores/{score}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $event_properties, + 'eventProperties', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sharing_key, + 'sharingKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($collection !== null) { + $resourcePath = str_replace( + '{collection}', + ObjectSerializer::toPathValue($collection), + $resourcePath + ); + } + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation editCollection + * + * Update a collection's metadata + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores (required) + * @param \Flat\APIClient\Model\CollectionModification $body body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['editCollection'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\Collection|\Flat\APIClient\Model\FlatErrorResponse + */ + public function editCollection( + string $collection, + \Flat\APIClient\Model\CollectionModification $body, + string $contentType = self::contentTypes['editCollection'][0] + ): \Flat\APIClient\Model\Collection|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->editCollectionWithHttpInfo($collection, $body, $contentType); + return $response; + } + + /** + * Operation editCollectionWithHttpInfo + * + * Update a collection's metadata + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores (required) + * @param \Flat\APIClient\Model\CollectionModification $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['editCollection'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\Collection|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function editCollectionWithHttpInfo( + string $collection, + \Flat\APIClient\Model\CollectionModification $body, + string $contentType = self::contentTypes['editCollection'][0] + ): array + { + $request = $this->editCollectionRequest($collection, $body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Collection', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Collection', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\Collection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation editCollectionAsync + * + * Update a collection's metadata + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores (required) + * @param \Flat\APIClient\Model\CollectionModification $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['editCollection'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function editCollectionAsync( + string $collection, + \Flat\APIClient\Model\CollectionModification $body, + string $contentType = self::contentTypes['editCollection'][0] + ): PromiseInterface + { + return $this->editCollectionAsyncWithHttpInfo($collection, $body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation editCollectionAsyncWithHttpInfo + * + * Update a collection's metadata + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores (required) + * @param \Flat\APIClient\Model\CollectionModification $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['editCollection'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function editCollectionAsyncWithHttpInfo( + string $collection, + \Flat\APIClient\Model\CollectionModification $body, + string $contentType = self::contentTypes['editCollection'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\Collection'; + $request = $this->editCollectionRequest($collection, $body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'editCollection' + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores (required) + * @param \Flat\APIClient\Model\CollectionModification $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['editCollection'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function editCollectionRequest( + string $collection, + \Flat\APIClient\Model\CollectionModification $body, + string $contentType = self::contentTypes['editCollection'][0] + ): Request + { + // verify the required parameter 'collection' is set + if ($collection === null || (is_array($collection) && count($collection) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $collection when calling editCollection' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling editCollection' + ); + } + + $resourcePath = '/collections/{collection}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($collection !== null) { + $resourcePath = str_replace( + '{collection}', + ObjectSerializer::toPathValue($collection), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getCollection + * + * Get collection details + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCollection'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\Collection|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getCollection( + string $collection, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getCollection'][0] + ): \Flat\APIClient\Model\Collection|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getCollectionWithHttpInfo($collection, $sharing_key, $contentType); + return $response; + } + + /** + * Operation getCollectionWithHttpInfo + * + * Get collection details + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCollection'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\Collection|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getCollectionWithHttpInfo( + string $collection, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getCollection'][0] + ): array + { + $request = $this->getCollectionRequest($collection, $sharing_key, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Collection', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Collection', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\Collection', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getCollectionAsync + * + * Get collection details + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCollection'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getCollectionAsync( + string $collection, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getCollection'][0] + ): PromiseInterface + { + return $this->getCollectionAsyncWithHttpInfo($collection, $sharing_key, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getCollectionAsyncWithHttpInfo + * + * Get collection details + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCollection'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getCollectionAsyncWithHttpInfo( + string $collection, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getCollection'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\Collection'; + $request = $this->getCollectionRequest($collection, $sharing_key, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getCollection' + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCollection'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getCollectionRequest( + string $collection, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getCollection'][0] + ): Request + { + // verify the required parameter 'collection' is set + if ($collection === null || (is_array($collection) && count($collection) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $collection when calling getCollection' + ); + } + + $resourcePath = '/collections/{collection}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sharing_key, + 'sharingKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($collection !== null) { + $resourcePath = str_replace( + '{collection}', + ObjectSerializer::toPathValue($collection), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listCollectionScores + * + * List the scores contained in a collection + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores (required) + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCollectionScores'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ScoreDetails[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function listCollectionScores( + string $collection, + ?string $sort = null, + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + ?string $sharing_key = null, + string $contentType = self::contentTypes['listCollectionScores'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->listCollectionScoresWithHttpInfo($collection, $sort, $direction, $limit, $next, $previous, $sharing_key, $contentType); + return $response; + } + + /** + * Operation listCollectionScoresWithHttpInfo + * + * List the scores contained in a collection + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores (required) + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCollectionScores'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ScoreDetails[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listCollectionScoresWithHttpInfo( + string $collection, + ?string $sort = null, + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + ?string $sharing_key = null, + string $contentType = self::contentTypes['listCollectionScores'][0] + ): array + { + $request = $this->listCollectionScoresRequest($collection, $sort, $direction, $limit, $next, $previous, $sharing_key, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails[]', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ScoreDetails[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listCollectionScoresAsync + * + * List the scores contained in a collection + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores (required) + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCollectionScores'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listCollectionScoresAsync( + string $collection, + ?string $sort = null, + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + ?string $sharing_key = null, + string $contentType = self::contentTypes['listCollectionScores'][0] + ): PromiseInterface + { + return $this->listCollectionScoresAsyncWithHttpInfo($collection, $sort, $direction, $limit, $next, $previous, $sharing_key, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listCollectionScoresAsyncWithHttpInfo + * + * List the scores contained in a collection + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores (required) + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCollectionScores'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listCollectionScoresAsyncWithHttpInfo( + string $collection, + ?string $sort = null, + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + ?string $sharing_key = null, + string $contentType = self::contentTypes['listCollectionScores'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ScoreDetails[]'; + $request = $this->listCollectionScoresRequest($collection, $sort, $direction, $limit, $next, $previous, $sharing_key, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listCollectionScores' + * + * @param string $collection Unique identifier of the collection. The following collection aliases are supported: - `root`: **Deprecated.** The root collection of the account - `app`: Alias for the current app collection - `trash`: Automatically contains resources that have been deleted The following virtual collections are supported: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores (required) + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCollectionScores'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listCollectionScoresRequest( + string $collection, + ?string $sort = null, + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + ?string $sharing_key = null, + string $contentType = self::contentTypes['listCollectionScores'][0] + ): Request + { + // verify the required parameter 'collection' is set + if ($collection === null || (is_array($collection) && count($collection) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $collection when calling listCollectionScores' + ); + } + if ($limit !== null && $limit > 100) { + throw new InvalidArgumentException('invalid value for "$limit" when calling CollectionApi.listCollectionScores, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new InvalidArgumentException('invalid value for "$limit" when calling CollectionApi.listCollectionScores, must be bigger than or equal to 1.'); + } + + $resourcePath = '/collections/{collection}/scores'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $direction, + 'direction', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $next, + 'next', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $previous, + 'previous', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sharing_key, + 'sharingKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($collection !== null) { + $resourcePath = str_replace( + '{collection}', + ObjectSerializer::toPathValue($collection), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listCollections + * + * List the collections + * + * @param string|null $parent List the collections contained in this `parent` collection. When set to `user` (default), returns the user's own collections as well as collections shared with the user. Using `root` or `sharedWithMe` is **deprecated** and will be treated as `user`. (optional, default to 'user') + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCollections'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\Collection[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function listCollections( + ?string $parent = 'user', + ?string $sort = null, + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['listCollections'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->listCollectionsWithHttpInfo($parent, $sort, $direction, $limit, $next, $previous, $contentType); + return $response; + } + + /** + * Operation listCollectionsWithHttpInfo + * + * List the collections + * + * @param string|null $parent List the collections contained in this `parent` collection. When set to `user` (default), returns the user's own collections as well as collections shared with the user. Using `root` or `sharedWithMe` is **deprecated** and will be treated as `user`. (optional, default to 'user') + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCollections'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\Collection[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listCollectionsWithHttpInfo( + ?string $parent = 'user', + ?string $sort = null, + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['listCollections'][0] + ): array + { + $request = $this->listCollectionsRequest($parent, $sort, $direction, $limit, $next, $previous, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Collection[]', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Collection[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\Collection[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listCollectionsAsync + * + * List the collections + * + * @param string|null $parent List the collections contained in this `parent` collection. When set to `user` (default), returns the user's own collections as well as collections shared with the user. Using `root` or `sharedWithMe` is **deprecated** and will be treated as `user`. (optional, default to 'user') + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCollections'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listCollectionsAsync( + ?string $parent = 'user', + ?string $sort = null, + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['listCollections'][0] + ): PromiseInterface + { + return $this->listCollectionsAsyncWithHttpInfo($parent, $sort, $direction, $limit, $next, $previous, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listCollectionsAsyncWithHttpInfo + * + * List the collections + * + * @param string|null $parent List the collections contained in this `parent` collection. When set to `user` (default), returns the user's own collections as well as collections shared with the user. Using `root` or `sharedWithMe` is **deprecated** and will be treated as `user`. (optional, default to 'user') + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCollections'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listCollectionsAsyncWithHttpInfo( + ?string $parent = 'user', + ?string $sort = null, + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['listCollections'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\Collection[]'; + $request = $this->listCollectionsRequest($parent, $sort, $direction, $limit, $next, $previous, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listCollections' + * + * @param string|null $parent List the collections contained in this `parent` collection. When set to `user` (default), returns the user's own collections as well as collections shared with the user. Using `root` or `sharedWithMe` is **deprecated** and will be treated as `user`. (optional, default to 'user') + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCollections'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listCollectionsRequest( + ?string $parent = 'user', + ?string $sort = null, + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['listCollections'][0] + ): Request + { + if ($limit !== null && $limit > 100) { + throw new InvalidArgumentException('invalid value for "$limit" when calling CollectionApi.listCollections, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new InvalidArgumentException('invalid value for "$limit" when calling CollectionApi.listCollections, must be bigger than or equal to 1.'); + } + + $resourcePath = '/collections'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $parent, + 'parent', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $direction, + 'direction', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $next, + 'next', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $previous, + 'previous', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation untrashCollection + * + * Untrash a collection + * + * @param string $collection Unique identifier of the collection. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['untrashCollection'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\FlatErrorResponse + * @deprecated + */ + public function untrashCollection( + string $collection, + string $contentType = self::contentTypes['untrashCollection'][0] + ): \Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->untrashCollectionWithHttpInfo($collection, $contentType); + return $response; + } + + /** + * Operation untrashCollectionWithHttpInfo + * + * Untrash a collection + * + * @param string $collection Unique identifier of the collection. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['untrashCollection'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + * @deprecated + */ + public function untrashCollectionWithHttpInfo( + string $collection, + string $contentType = self::contentTypes['untrashCollection'][0] + ): array + { + $request = $this->untrashCollectionRequest($collection, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 400: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation untrashCollectionAsync + * + * Untrash a collection + * + * @param string $collection Unique identifier of the collection. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['untrashCollection'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + * @deprecated + */ + public function untrashCollectionAsync( + string $collection, + string $contentType = self::contentTypes['untrashCollection'][0] + ): PromiseInterface + { + return $this->untrashCollectionAsyncWithHttpInfo($collection, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation untrashCollectionAsyncWithHttpInfo + * + * Untrash a collection + * + * @param string $collection Unique identifier of the collection. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['untrashCollection'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + * @deprecated + */ + public function untrashCollectionAsyncWithHttpInfo( + string $collection, + string $contentType = self::contentTypes['untrashCollection'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\FlatErrorResponse'; + $request = $this->untrashCollectionRequest($collection, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'untrashCollection' + * + * @param string $collection Unique identifier of the collection. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['untrashCollection'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + * @deprecated + */ + public function untrashCollectionRequest( + string $collection, + string $contentType = self::contentTypes['untrashCollection'][0] + ): Request + { + // verify the required parameter 'collection' is set + if ($collection === null || (is_array($collection) && count($collection) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $collection when calling untrashCollection' + ); + } + + $resourcePath = '/collections/{collection}/untrash'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($collection !== null) { + $resourcePath = str_replace( + '{collection}', + ObjectSerializer::toPathValue($collection), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/src/Api/EduResourcesApi.php b/src/Api/EduResourcesApi.php new file mode 100644 index 0000000..2285bd0 --- /dev/null +++ b/src/Api/EduResourcesApi.php @@ -0,0 +1,3840 @@ + $contentTypes **/ + public const contentTypes = [ + 'copyEduResource' => [ + 'application/json', + ], + 'copyEduResourceToDemoClass' => [ + 'application/json', + ], + 'createEduResource' => [ + 'application/json', + ], + 'createEduResourceLtiLink' => [ + 'application/json', + ], + 'deleteEduResource' => [ + 'application/json', + ], + 'getEduResource' => [ + 'application/json', + ], + 'listEduLibraries' => [ + 'application/json', + ], + 'listEduResources' => [ + 'application/json', + ], + 'moveEduResource' => [ + 'application/json', + ], + 'updateEduResource' => [ + 'application/json', + ], + 'updateEduResourceAssignment' => [ + 'application/json', + ], + 'useEduResourceInClass' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation copyEduResource + * + * Copy an education resource to a Resource Library + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\EduResourceCopy $edu_resource_copy edu_resource_copy (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['copyEduResource'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\EduResource|\Flat\APIClient\Model\FlatErrorResponse + */ + public function copyEduResource( + string $resource, + \Flat\APIClient\Model\EduResourceCopy $edu_resource_copy, + string $contentType = self::contentTypes['copyEduResource'][0] + ): \Flat\APIClient\Model\EduResource|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->copyEduResourceWithHttpInfo($resource, $edu_resource_copy, $contentType); + return $response; + } + + /** + * Operation copyEduResourceWithHttpInfo + * + * Copy an education resource to a Resource Library + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\EduResourceCopy $edu_resource_copy (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['copyEduResource'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\EduResource|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function copyEduResourceWithHttpInfo( + string $resource, + \Flat\APIClient\Model\EduResourceCopy $edu_resource_copy, + string $contentType = self::contentTypes['copyEduResource'][0] + ): array + { + $request = $this->copyEduResourceRequest($resource, $edu_resource_copy, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\EduResource', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\EduResource', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\EduResource', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation copyEduResourceAsync + * + * Copy an education resource to a Resource Library + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\EduResourceCopy $edu_resource_copy (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['copyEduResource'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function copyEduResourceAsync( + string $resource, + \Flat\APIClient\Model\EduResourceCopy $edu_resource_copy, + string $contentType = self::contentTypes['copyEduResource'][0] + ): PromiseInterface + { + return $this->copyEduResourceAsyncWithHttpInfo($resource, $edu_resource_copy, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation copyEduResourceAsyncWithHttpInfo + * + * Copy an education resource to a Resource Library + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\EduResourceCopy $edu_resource_copy (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['copyEduResource'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function copyEduResourceAsyncWithHttpInfo( + string $resource, + \Flat\APIClient\Model\EduResourceCopy $edu_resource_copy, + string $contentType = self::contentTypes['copyEduResource'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\EduResource'; + $request = $this->copyEduResourceRequest($resource, $edu_resource_copy, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'copyEduResource' + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\EduResourceCopy $edu_resource_copy (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['copyEduResource'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function copyEduResourceRequest( + string $resource, + \Flat\APIClient\Model\EduResourceCopy $edu_resource_copy, + string $contentType = self::contentTypes['copyEduResource'][0] + ): Request + { + // verify the required parameter 'resource' is set + if ($resource === null || (is_array($resource) && count($resource) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $resource when calling copyEduResource' + ); + } + // verify the required parameter 'edu_resource_copy' is set + if ($edu_resource_copy === null || (is_array($edu_resource_copy) && count($edu_resource_copy) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $edu_resource_copy when calling copyEduResource' + ); + } + + $resourcePath = '/eduResources/{resource}/copy'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($resource !== null) { + $resourcePath = str_replace( + '{resource}', + ObjectSerializer::toPathValue($resource), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($edu_resource_copy)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($edu_resource_copy)); + } else { + $httpBody = $edu_resource_copy; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation copyEduResourceToDemoClass + * + * Copy an education assignment to a teacher demo class + * + * @param string $resource Unique identifier of the resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['copyEduResourceToDemoClass'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ClassAssignment|\Flat\APIClient\Model\FlatErrorResponse + */ + public function copyEduResourceToDemoClass( + string $resource, + string $contentType = self::contentTypes['copyEduResourceToDemoClass'][0] + ): \Flat\APIClient\Model\ClassAssignment|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->copyEduResourceToDemoClassWithHttpInfo($resource, $contentType); + return $response; + } + + /** + * Operation copyEduResourceToDemoClassWithHttpInfo + * + * Copy an education assignment to a teacher demo class + * + * @param string $resource Unique identifier of the resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['copyEduResourceToDemoClass'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ClassAssignment|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function copyEduResourceToDemoClassWithHttpInfo( + string $resource, + string $contentType = self::contentTypes['copyEduResourceToDemoClass'][0] + ): array + { + $request = $this->copyEduResourceToDemoClassRequest($resource, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ClassAssignment', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ClassAssignment', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ClassAssignment', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation copyEduResourceToDemoClassAsync + * + * Copy an education assignment to a teacher demo class + * + * @param string $resource Unique identifier of the resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['copyEduResourceToDemoClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function copyEduResourceToDemoClassAsync( + string $resource, + string $contentType = self::contentTypes['copyEduResourceToDemoClass'][0] + ): PromiseInterface + { + return $this->copyEduResourceToDemoClassAsyncWithHttpInfo($resource, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation copyEduResourceToDemoClassAsyncWithHttpInfo + * + * Copy an education assignment to a teacher demo class + * + * @param string $resource Unique identifier of the resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['copyEduResourceToDemoClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function copyEduResourceToDemoClassAsyncWithHttpInfo( + string $resource, + string $contentType = self::contentTypes['copyEduResourceToDemoClass'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ClassAssignment'; + $request = $this->copyEduResourceToDemoClassRequest($resource, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'copyEduResourceToDemoClass' + * + * @param string $resource Unique identifier of the resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['copyEduResourceToDemoClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function copyEduResourceToDemoClassRequest( + string $resource, + string $contentType = self::contentTypes['copyEduResourceToDemoClass'][0] + ): Request + { + // verify the required parameter 'resource' is set + if ($resource === null || (is_array($resource) && count($resource) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $resource when calling copyEduResourceToDemoClass' + ); + } + + $resourcePath = '/eduResources/{resource}/copyToDemoClass'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($resource !== null) { + $resourcePath = str_replace( + '{resource}', + ObjectSerializer::toPathValue($resource), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createEduResource + * + * Create a new education resource + * + * @param \Flat\APIClient\Model\EduResourceCreation $edu_resource_creation edu_resource_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEduResource'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\EduResource|\Flat\APIClient\Model\FlatErrorResponse + */ + public function createEduResource( + \Flat\APIClient\Model\EduResourceCreation $edu_resource_creation, + string $contentType = self::contentTypes['createEduResource'][0] + ): \Flat\APIClient\Model\EduResource|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->createEduResourceWithHttpInfo($edu_resource_creation, $contentType); + return $response; + } + + /** + * Operation createEduResourceWithHttpInfo + * + * Create a new education resource + * + * @param \Flat\APIClient\Model\EduResourceCreation $edu_resource_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEduResource'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\EduResource|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createEduResourceWithHttpInfo( + \Flat\APIClient\Model\EduResourceCreation $edu_resource_creation, + string $contentType = self::contentTypes['createEduResource'][0] + ): array + { + $request = $this->createEduResourceRequest($edu_resource_creation, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\EduResource', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\EduResource', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\EduResource', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createEduResourceAsync + * + * Create a new education resource + * + * @param \Flat\APIClient\Model\EduResourceCreation $edu_resource_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEduResource'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createEduResourceAsync( + \Flat\APIClient\Model\EduResourceCreation $edu_resource_creation, + string $contentType = self::contentTypes['createEduResource'][0] + ): PromiseInterface + { + return $this->createEduResourceAsyncWithHttpInfo($edu_resource_creation, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createEduResourceAsyncWithHttpInfo + * + * Create a new education resource + * + * @param \Flat\APIClient\Model\EduResourceCreation $edu_resource_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEduResource'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createEduResourceAsyncWithHttpInfo( + \Flat\APIClient\Model\EduResourceCreation $edu_resource_creation, + string $contentType = self::contentTypes['createEduResource'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\EduResource'; + $request = $this->createEduResourceRequest($edu_resource_creation, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createEduResource' + * + * @param \Flat\APIClient\Model\EduResourceCreation $edu_resource_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEduResource'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createEduResourceRequest( + \Flat\APIClient\Model\EduResourceCreation $edu_resource_creation, + string $contentType = self::contentTypes['createEduResource'][0] + ): Request + { + // verify the required parameter 'edu_resource_creation' is set + if ($edu_resource_creation === null || (is_array($edu_resource_creation) && count($edu_resource_creation) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $edu_resource_creation when calling createEduResource' + ); + } + + $resourcePath = '/eduResources'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($edu_resource_creation)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($edu_resource_creation)); + } else { + $httpBody = $edu_resource_creation; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createEduResourceLtiLink + * + * Create an LTI link for an education resource + * + * @param string $resource Unique identifier of the resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEduResourceLtiLink'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\EduResourceLtiLink|\Flat\APIClient\Model\FlatErrorResponse + */ + public function createEduResourceLtiLink( + string $resource, + string $contentType = self::contentTypes['createEduResourceLtiLink'][0] + ): \Flat\APIClient\Model\EduResourceLtiLink|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->createEduResourceLtiLinkWithHttpInfo($resource, $contentType); + return $response; + } + + /** + * Operation createEduResourceLtiLinkWithHttpInfo + * + * Create an LTI link for an education resource + * + * @param string $resource Unique identifier of the resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEduResourceLtiLink'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\EduResourceLtiLink|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createEduResourceLtiLinkWithHttpInfo( + string $resource, + string $contentType = self::contentTypes['createEduResourceLtiLink'][0] + ): array + { + $request = $this->createEduResourceLtiLinkRequest($resource, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\EduResourceLtiLink', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\EduResourceLtiLink', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\EduResourceLtiLink', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createEduResourceLtiLinkAsync + * + * Create an LTI link for an education resource + * + * @param string $resource Unique identifier of the resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEduResourceLtiLink'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createEduResourceLtiLinkAsync( + string $resource, + string $contentType = self::contentTypes['createEduResourceLtiLink'][0] + ): PromiseInterface + { + return $this->createEduResourceLtiLinkAsyncWithHttpInfo($resource, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createEduResourceLtiLinkAsyncWithHttpInfo + * + * Create an LTI link for an education resource + * + * @param string $resource Unique identifier of the resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEduResourceLtiLink'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createEduResourceLtiLinkAsyncWithHttpInfo( + string $resource, + string $contentType = self::contentTypes['createEduResourceLtiLink'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\EduResourceLtiLink'; + $request = $this->createEduResourceLtiLinkRequest($resource, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createEduResourceLtiLink' + * + * @param string $resource Unique identifier of the resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEduResourceLtiLink'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createEduResourceLtiLinkRequest( + string $resource, + string $contentType = self::contentTypes['createEduResourceLtiLink'][0] + ): Request + { + // verify the required parameter 'resource' is set + if ($resource === null || (is_array($resource) && count($resource) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $resource when calling createEduResourceLtiLink' + ); + } + + $resourcePath = '/eduResources/{resource}/createLtiLink'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($resource !== null) { + $resourcePath = str_replace( + '{resource}', + ObjectSerializer::toPathValue($resource), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteEduResource + * + * Delete an education resource + * + * @param string $resource Unique identifier of the resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEduResource'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\FlatErrorResponse|null + */ + public function deleteEduResource( + string $resource, + string $contentType = self::contentTypes['deleteEduResource'][0] + ): ?\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->deleteEduResourceWithHttpInfo($resource, $contentType); + return $response; + } + + /** + * Operation deleteEduResourceWithHttpInfo + * + * Delete an education resource + * + * @param string $resource Unique identifier of the resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEduResource'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function deleteEduResourceWithHttpInfo( + string $resource, + string $contentType = self::contentTypes['deleteEduResource'][0] + ): array + { + $request = $this->deleteEduResourceRequest($resource, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation deleteEduResourceAsync + * + * Delete an education resource + * + * @param string $resource Unique identifier of the resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEduResource'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteEduResourceAsync( + string $resource, + string $contentType = self::contentTypes['deleteEduResource'][0] + ): PromiseInterface + { + return $this->deleteEduResourceAsyncWithHttpInfo($resource, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteEduResourceAsyncWithHttpInfo + * + * Delete an education resource + * + * @param string $resource Unique identifier of the resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEduResource'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteEduResourceAsyncWithHttpInfo( + string $resource, + string $contentType = self::contentTypes['deleteEduResource'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deleteEduResourceRequest($resource, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteEduResource' + * + * @param string $resource Unique identifier of the resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEduResource'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteEduResourceRequest( + string $resource, + string $contentType = self::contentTypes['deleteEduResource'][0] + ): Request + { + // verify the required parameter 'resource' is set + if ($resource === null || (is_array($resource) && count($resource) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $resource when calling deleteEduResource' + ); + } + + $resourcePath = '/eduResources/{resource}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($resource !== null) { + $resourcePath = str_replace( + '{resource}', + ObjectSerializer::toPathValue($resource), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getEduResource + * + * Get an education resource + * + * @param string $resource Unique identifier of the resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEduResource'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\EduResource|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getEduResource( + string $resource, + string $contentType = self::contentTypes['getEduResource'][0] + ): \Flat\APIClient\Model\EduResource|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getEduResourceWithHttpInfo($resource, $contentType); + return $response; + } + + /** + * Operation getEduResourceWithHttpInfo + * + * Get an education resource + * + * @param string $resource Unique identifier of the resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEduResource'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\EduResource|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getEduResourceWithHttpInfo( + string $resource, + string $contentType = self::contentTypes['getEduResource'][0] + ): array + { + $request = $this->getEduResourceRequest($resource, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\EduResource', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\EduResource', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\EduResource', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getEduResourceAsync + * + * Get an education resource + * + * @param string $resource Unique identifier of the resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEduResource'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getEduResourceAsync( + string $resource, + string $contentType = self::contentTypes['getEduResource'][0] + ): PromiseInterface + { + return $this->getEduResourceAsyncWithHttpInfo($resource, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEduResourceAsyncWithHttpInfo + * + * Get an education resource + * + * @param string $resource Unique identifier of the resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEduResource'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getEduResourceAsyncWithHttpInfo( + string $resource, + string $contentType = self::contentTypes['getEduResource'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\EduResource'; + $request = $this->getEduResourceRequest($resource, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getEduResource' + * + * @param string $resource Unique identifier of the resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEduResource'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEduResourceRequest( + string $resource, + string $contentType = self::contentTypes['getEduResource'][0] + ): Request + { + // verify the required parameter 'resource' is set + if ($resource === null || (is_array($resource) && count($resource) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $resource when calling getEduResource' + ); + } + + $resourcePath = '/eduResources/{resource}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($resource !== null) { + $resourcePath = str_replace( + '{resource}', + ObjectSerializer::toPathValue($resource), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listEduLibraries + * + * List the education libraries + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEduLibraries'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\EduLibrary[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function listEduLibraries( + string $contentType = self::contentTypes['listEduLibraries'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->listEduLibrariesWithHttpInfo($contentType); + return $response; + } + + /** + * Operation listEduLibrariesWithHttpInfo + * + * List the education libraries + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEduLibraries'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\EduLibrary[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listEduLibrariesWithHttpInfo( + string $contentType = self::contentTypes['listEduLibraries'][0] + ): array + { + $request = $this->listEduLibrariesRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\EduLibrary[]', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\EduLibrary[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\EduLibrary[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listEduLibrariesAsync + * + * List the education libraries + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEduLibraries'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listEduLibrariesAsync( + string $contentType = self::contentTypes['listEduLibraries'][0] + ): PromiseInterface + { + return $this->listEduLibrariesAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listEduLibrariesAsyncWithHttpInfo + * + * List the education libraries + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEduLibraries'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listEduLibrariesAsyncWithHttpInfo( + string $contentType = self::contentTypes['listEduLibraries'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\EduLibrary[]'; + $request = $this->listEduLibrariesRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listEduLibraries' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEduLibraries'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listEduLibrariesRequest( + string $contentType = self::contentTypes['listEduLibraries'][0] + ): Request + { + + $resourcePath = '/eduResources/libraries'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listEduResources + * + * List education resources in a library or folder + * + * @param string|null $parent List the resources contained in this `parent` library or folder. Accepts a folder identifier, or the identifier of one of the libraries returned by [`listEduLibraries`](#tag/EduResources/operation/listEduLibraries). Which libraries are available depends on the account, so use the `id` values that endpoint returns rather than hardcoding this list: * `root`: the user's own resources * `organization`: resources shared with the organization (optional, default to 'root') + * @param bool|null $without_subfolders_resources For the `parent` = `organization`, do not include resources from subfolders. By default in the Resource Library UI, we include resources from subfolders, but for example in a picker like LTI, we don't want to include them. (optional) + * @param string|null $type Filter the returned resources by type (optional) + * @param \Flat\APIClient\Model\TeachingTheme[]|null $subjects Filter the returned resources by subjects (optional) + * @param \Flat\APIClient\Model\AssignmentType[]|null $assignment_types Filter the returned resources by assignment types (optional) + * @param \Flat\APIClient\Model\Grade[]|null $grades Filter the returned resources by grades (optional) + * @param string|null $sort Sort (optional, default to 'creationDate') + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of resources that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEduResources'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\EduResource[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function listEduResources( + ?string $parent = 'root', + ?bool $without_subfolders_resources = null, + ?string $type = null, + ?array $subjects = null, + ?array $assignment_types = null, + ?array $grades = null, + ?string $sort = 'creationDate', + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['listEduResources'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->listEduResourcesWithHttpInfo($parent, $without_subfolders_resources, $type, $subjects, $assignment_types, $grades, $sort, $direction, $limit, $next, $previous, $contentType); + return $response; + } + + /** + * Operation listEduResourcesWithHttpInfo + * + * List education resources in a library or folder + * + * @param string|null $parent List the resources contained in this `parent` library or folder. Accepts a folder identifier, or the identifier of one of the libraries returned by [`listEduLibraries`](#tag/EduResources/operation/listEduLibraries). Which libraries are available depends on the account, so use the `id` values that endpoint returns rather than hardcoding this list: * `root`: the user's own resources * `organization`: resources shared with the organization (optional, default to 'root') + * @param bool|null $without_subfolders_resources For the `parent` = `organization`, do not include resources from subfolders. By default in the Resource Library UI, we include resources from subfolders, but for example in a picker like LTI, we don't want to include them. (optional) + * @param string|null $type Filter the returned resources by type (optional) + * @param \Flat\APIClient\Model\TeachingTheme[]|null $subjects Filter the returned resources by subjects (optional) + * @param \Flat\APIClient\Model\AssignmentType[]|null $assignment_types Filter the returned resources by assignment types (optional) + * @param \Flat\APIClient\Model\Grade[]|null $grades Filter the returned resources by grades (optional) + * @param string|null $sort Sort (optional, default to 'creationDate') + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of resources that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEduResources'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\EduResource[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listEduResourcesWithHttpInfo( + ?string $parent = 'root', + ?bool $without_subfolders_resources = null, + ?string $type = null, + ?array $subjects = null, + ?array $assignment_types = null, + ?array $grades = null, + ?string $sort = 'creationDate', + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['listEduResources'][0] + ): array + { + $request = $this->listEduResourcesRequest($parent, $without_subfolders_resources, $type, $subjects, $assignment_types, $grades, $sort, $direction, $limit, $next, $previous, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\EduResource[]', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\EduResource[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\EduResource[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listEduResourcesAsync + * + * List education resources in a library or folder + * + * @param string|null $parent List the resources contained in this `parent` library or folder. Accepts a folder identifier, or the identifier of one of the libraries returned by [`listEduLibraries`](#tag/EduResources/operation/listEduLibraries). Which libraries are available depends on the account, so use the `id` values that endpoint returns rather than hardcoding this list: * `root`: the user's own resources * `organization`: resources shared with the organization (optional, default to 'root') + * @param bool|null $without_subfolders_resources For the `parent` = `organization`, do not include resources from subfolders. By default in the Resource Library UI, we include resources from subfolders, but for example in a picker like LTI, we don't want to include them. (optional) + * @param string|null $type Filter the returned resources by type (optional) + * @param \Flat\APIClient\Model\TeachingTheme[]|null $subjects Filter the returned resources by subjects (optional) + * @param \Flat\APIClient\Model\AssignmentType[]|null $assignment_types Filter the returned resources by assignment types (optional) + * @param \Flat\APIClient\Model\Grade[]|null $grades Filter the returned resources by grades (optional) + * @param string|null $sort Sort (optional, default to 'creationDate') + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of resources that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEduResources'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listEduResourcesAsync( + ?string $parent = 'root', + ?bool $without_subfolders_resources = null, + ?string $type = null, + ?array $subjects = null, + ?array $assignment_types = null, + ?array $grades = null, + ?string $sort = 'creationDate', + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['listEduResources'][0] + ): PromiseInterface + { + return $this->listEduResourcesAsyncWithHttpInfo($parent, $without_subfolders_resources, $type, $subjects, $assignment_types, $grades, $sort, $direction, $limit, $next, $previous, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listEduResourcesAsyncWithHttpInfo + * + * List education resources in a library or folder + * + * @param string|null $parent List the resources contained in this `parent` library or folder. Accepts a folder identifier, or the identifier of one of the libraries returned by [`listEduLibraries`](#tag/EduResources/operation/listEduLibraries). Which libraries are available depends on the account, so use the `id` values that endpoint returns rather than hardcoding this list: * `root`: the user's own resources * `organization`: resources shared with the organization (optional, default to 'root') + * @param bool|null $without_subfolders_resources For the `parent` = `organization`, do not include resources from subfolders. By default in the Resource Library UI, we include resources from subfolders, but for example in a picker like LTI, we don't want to include them. (optional) + * @param string|null $type Filter the returned resources by type (optional) + * @param \Flat\APIClient\Model\TeachingTheme[]|null $subjects Filter the returned resources by subjects (optional) + * @param \Flat\APIClient\Model\AssignmentType[]|null $assignment_types Filter the returned resources by assignment types (optional) + * @param \Flat\APIClient\Model\Grade[]|null $grades Filter the returned resources by grades (optional) + * @param string|null $sort Sort (optional, default to 'creationDate') + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of resources that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEduResources'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listEduResourcesAsyncWithHttpInfo( + ?string $parent = 'root', + ?bool $without_subfolders_resources = null, + ?string $type = null, + ?array $subjects = null, + ?array $assignment_types = null, + ?array $grades = null, + ?string $sort = 'creationDate', + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['listEduResources'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\EduResource[]'; + $request = $this->listEduResourcesRequest($parent, $without_subfolders_resources, $type, $subjects, $assignment_types, $grades, $sort, $direction, $limit, $next, $previous, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listEduResources' + * + * @param string|null $parent List the resources contained in this `parent` library or folder. Accepts a folder identifier, or the identifier of one of the libraries returned by [`listEduLibraries`](#tag/EduResources/operation/listEduLibraries). Which libraries are available depends on the account, so use the `id` values that endpoint returns rather than hardcoding this list: * `root`: the user's own resources * `organization`: resources shared with the organization (optional, default to 'root') + * @param bool|null $without_subfolders_resources For the `parent` = `organization`, do not include resources from subfolders. By default in the Resource Library UI, we include resources from subfolders, but for example in a picker like LTI, we don't want to include them. (optional) + * @param string|null $type Filter the returned resources by type (optional) + * @param \Flat\APIClient\Model\TeachingTheme[]|null $subjects Filter the returned resources by subjects (optional) + * @param \Flat\APIClient\Model\AssignmentType[]|null $assignment_types Filter the returned resources by assignment types (optional) + * @param \Flat\APIClient\Model\Grade[]|null $grades Filter the returned resources by grades (optional) + * @param string|null $sort Sort (optional, default to 'creationDate') + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of resources that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEduResources'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listEduResourcesRequest( + ?string $parent = 'root', + ?bool $without_subfolders_resources = null, + ?string $type = null, + ?array $subjects = null, + ?array $assignment_types = null, + ?array $grades = null, + ?string $sort = 'creationDate', + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['listEduResources'][0] + ): Request + { + if ($limit !== null && $limit > 100) { + throw new InvalidArgumentException('invalid value for "$limit" when calling EduResourcesApi.listEduResources, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new InvalidArgumentException('invalid value for "$limit" when calling EduResourcesApi.listEduResources, must be bigger than or equal to 1.'); + } + + $resourcePath = '/eduResources'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $parent, + 'parent', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $without_subfolders_resources, + 'withoutSubfoldersResources', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $type, + 'type', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $subjects, + 'subjects', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $assignment_types, + 'assignmentTypes', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $grades, + 'grades', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $direction, + 'direction', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $next, + 'next', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $previous, + 'previous', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation moveEduResource + * + * Move an education resource + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\EduResourceMove $edu_resource_move edu_resource_move (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['moveEduResource'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\EduResource|\Flat\APIClient\Model\FlatErrorResponse + */ + public function moveEduResource( + string $resource, + \Flat\APIClient\Model\EduResourceMove $edu_resource_move, + string $contentType = self::contentTypes['moveEduResource'][0] + ): \Flat\APIClient\Model\EduResource|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->moveEduResourceWithHttpInfo($resource, $edu_resource_move, $contentType); + return $response; + } + + /** + * Operation moveEduResourceWithHttpInfo + * + * Move an education resource + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\EduResourceMove $edu_resource_move (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['moveEduResource'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\EduResource|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function moveEduResourceWithHttpInfo( + string $resource, + \Flat\APIClient\Model\EduResourceMove $edu_resource_move, + string $contentType = self::contentTypes['moveEduResource'][0] + ): array + { + $request = $this->moveEduResourceRequest($resource, $edu_resource_move, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\EduResource', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\EduResource', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\EduResource', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation moveEduResourceAsync + * + * Move an education resource + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\EduResourceMove $edu_resource_move (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['moveEduResource'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function moveEduResourceAsync( + string $resource, + \Flat\APIClient\Model\EduResourceMove $edu_resource_move, + string $contentType = self::contentTypes['moveEduResource'][0] + ): PromiseInterface + { + return $this->moveEduResourceAsyncWithHttpInfo($resource, $edu_resource_move, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation moveEduResourceAsyncWithHttpInfo + * + * Move an education resource + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\EduResourceMove $edu_resource_move (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['moveEduResource'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function moveEduResourceAsyncWithHttpInfo( + string $resource, + \Flat\APIClient\Model\EduResourceMove $edu_resource_move, + string $contentType = self::contentTypes['moveEduResource'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\EduResource'; + $request = $this->moveEduResourceRequest($resource, $edu_resource_move, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'moveEduResource' + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\EduResourceMove $edu_resource_move (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['moveEduResource'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function moveEduResourceRequest( + string $resource, + \Flat\APIClient\Model\EduResourceMove $edu_resource_move, + string $contentType = self::contentTypes['moveEduResource'][0] + ): Request + { + // verify the required parameter 'resource' is set + if ($resource === null || (is_array($resource) && count($resource) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $resource when calling moveEduResource' + ); + } + // verify the required parameter 'edu_resource_move' is set + if ($edu_resource_move === null || (is_array($edu_resource_move) && count($edu_resource_move) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $edu_resource_move when calling moveEduResource' + ); + } + + $resourcePath = '/eduResources/{resource}/move'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($resource !== null) { + $resourcePath = str_replace( + '{resource}', + ObjectSerializer::toPathValue($resource), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($edu_resource_move)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($edu_resource_move)); + } else { + $httpBody = $edu_resource_move; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateEduResource + * + * Update an education resource metadata + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\EduResourceUpdate $edu_resource_update edu_resource_update (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEduResource'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\EduResource|\Flat\APIClient\Model\FlatErrorResponse + */ + public function updateEduResource( + string $resource, + \Flat\APIClient\Model\EduResourceUpdate $edu_resource_update, + string $contentType = self::contentTypes['updateEduResource'][0] + ): \Flat\APIClient\Model\EduResource|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->updateEduResourceWithHttpInfo($resource, $edu_resource_update, $contentType); + return $response; + } + + /** + * Operation updateEduResourceWithHttpInfo + * + * Update an education resource metadata + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\EduResourceUpdate $edu_resource_update (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEduResource'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\EduResource|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function updateEduResourceWithHttpInfo( + string $resource, + \Flat\APIClient\Model\EduResourceUpdate $edu_resource_update, + string $contentType = self::contentTypes['updateEduResource'][0] + ): array + { + $request = $this->updateEduResourceRequest($resource, $edu_resource_update, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\EduResource', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\EduResource', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\EduResource', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation updateEduResourceAsync + * + * Update an education resource metadata + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\EduResourceUpdate $edu_resource_update (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEduResource'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateEduResourceAsync( + string $resource, + \Flat\APIClient\Model\EduResourceUpdate $edu_resource_update, + string $contentType = self::contentTypes['updateEduResource'][0] + ): PromiseInterface + { + return $this->updateEduResourceAsyncWithHttpInfo($resource, $edu_resource_update, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateEduResourceAsyncWithHttpInfo + * + * Update an education resource metadata + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\EduResourceUpdate $edu_resource_update (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEduResource'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateEduResourceAsyncWithHttpInfo( + string $resource, + \Flat\APIClient\Model\EduResourceUpdate $edu_resource_update, + string $contentType = self::contentTypes['updateEduResource'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\EduResource'; + $request = $this->updateEduResourceRequest($resource, $edu_resource_update, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateEduResource' + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\EduResourceUpdate $edu_resource_update (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEduResource'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateEduResourceRequest( + string $resource, + \Flat\APIClient\Model\EduResourceUpdate $edu_resource_update, + string $contentType = self::contentTypes['updateEduResource'][0] + ): Request + { + // verify the required parameter 'resource' is set + if ($resource === null || (is_array($resource) && count($resource) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $resource when calling updateEduResource' + ); + } + // verify the required parameter 'edu_resource_update' is set + if ($edu_resource_update === null || (is_array($edu_resource_update) && count($edu_resource_update) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $edu_resource_update when calling updateEduResource' + ); + } + + $resourcePath = '/eduResources/{resource}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($resource !== null) { + $resourcePath = str_replace( + '{resource}', + ObjectSerializer::toPathValue($resource), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($edu_resource_update)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($edu_resource_update)); + } else { + $httpBody = $edu_resource_update; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateEduResourceAssignment + * + * Update an education resource assignment + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\AssignmentUpdate $assignment_update assignment_update (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEduResourceAssignment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\Assignment|\Flat\APIClient\Model\FlatErrorResponse + */ + public function updateEduResourceAssignment( + string $resource, + \Flat\APIClient\Model\AssignmentUpdate $assignment_update, + string $contentType = self::contentTypes['updateEduResourceAssignment'][0] + ): \Flat\APIClient\Model\Assignment|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->updateEduResourceAssignmentWithHttpInfo($resource, $assignment_update, $contentType); + return $response; + } + + /** + * Operation updateEduResourceAssignmentWithHttpInfo + * + * Update an education resource assignment + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\AssignmentUpdate $assignment_update (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEduResourceAssignment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\Assignment|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function updateEduResourceAssignmentWithHttpInfo( + string $resource, + \Flat\APIClient\Model\AssignmentUpdate $assignment_update, + string $contentType = self::contentTypes['updateEduResourceAssignment'][0] + ): array + { + $request = $this->updateEduResourceAssignmentRequest($resource, $assignment_update, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Assignment', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Assignment', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\Assignment', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation updateEduResourceAssignmentAsync + * + * Update an education resource assignment + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\AssignmentUpdate $assignment_update (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEduResourceAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateEduResourceAssignmentAsync( + string $resource, + \Flat\APIClient\Model\AssignmentUpdate $assignment_update, + string $contentType = self::contentTypes['updateEduResourceAssignment'][0] + ): PromiseInterface + { + return $this->updateEduResourceAssignmentAsyncWithHttpInfo($resource, $assignment_update, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateEduResourceAssignmentAsyncWithHttpInfo + * + * Update an education resource assignment + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\AssignmentUpdate $assignment_update (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEduResourceAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateEduResourceAssignmentAsyncWithHttpInfo( + string $resource, + \Flat\APIClient\Model\AssignmentUpdate $assignment_update, + string $contentType = self::contentTypes['updateEduResourceAssignment'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\Assignment'; + $request = $this->updateEduResourceAssignmentRequest($resource, $assignment_update, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateEduResourceAssignment' + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\AssignmentUpdate $assignment_update (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEduResourceAssignment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateEduResourceAssignmentRequest( + string $resource, + \Flat\APIClient\Model\AssignmentUpdate $assignment_update, + string $contentType = self::contentTypes['updateEduResourceAssignment'][0] + ): Request + { + // verify the required parameter 'resource' is set + if ($resource === null || (is_array($resource) && count($resource) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $resource when calling updateEduResourceAssignment' + ); + } + // verify the required parameter 'assignment_update' is set + if ($assignment_update === null || (is_array($assignment_update) && count($assignment_update) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $assignment_update when calling updateEduResourceAssignment' + ); + } + + $resourcePath = '/eduResources/{resource}/assignment'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($resource !== null) { + $resourcePath = str_replace( + '{resource}', + ObjectSerializer::toPathValue($resource), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($assignment_update)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($assignment_update)); + } else { + $httpBody = $assignment_update; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation useEduResourceInClass + * + * Use an education resource in a class + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\EduResourceUseInClass $edu_resource_use_in_class edu_resource_use_in_class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['useEduResourceInClass'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ClassAssignment|\Flat\APIClient\Model\FlatErrorResponse + */ + public function useEduResourceInClass( + string $resource, + \Flat\APIClient\Model\EduResourceUseInClass $edu_resource_use_in_class, + string $contentType = self::contentTypes['useEduResourceInClass'][0] + ): \Flat\APIClient\Model\ClassAssignment|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->useEduResourceInClassWithHttpInfo($resource, $edu_resource_use_in_class, $contentType); + return $response; + } + + /** + * Operation useEduResourceInClassWithHttpInfo + * + * Use an education resource in a class + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\EduResourceUseInClass $edu_resource_use_in_class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['useEduResourceInClass'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ClassAssignment|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function useEduResourceInClassWithHttpInfo( + string $resource, + \Flat\APIClient\Model\EduResourceUseInClass $edu_resource_use_in_class, + string $contentType = self::contentTypes['useEduResourceInClass'][0] + ): array + { + $request = $this->useEduResourceInClassRequest($resource, $edu_resource_use_in_class, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ClassAssignment', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ClassAssignment', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ClassAssignment', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation useEduResourceInClassAsync + * + * Use an education resource in a class + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\EduResourceUseInClass $edu_resource_use_in_class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['useEduResourceInClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function useEduResourceInClassAsync( + string $resource, + \Flat\APIClient\Model\EduResourceUseInClass $edu_resource_use_in_class, + string $contentType = self::contentTypes['useEduResourceInClass'][0] + ): PromiseInterface + { + return $this->useEduResourceInClassAsyncWithHttpInfo($resource, $edu_resource_use_in_class, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation useEduResourceInClassAsyncWithHttpInfo + * + * Use an education resource in a class + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\EduResourceUseInClass $edu_resource_use_in_class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['useEduResourceInClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function useEduResourceInClassAsyncWithHttpInfo( + string $resource, + \Flat\APIClient\Model\EduResourceUseInClass $edu_resource_use_in_class, + string $contentType = self::contentTypes['useEduResourceInClass'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ClassAssignment'; + $request = $this->useEduResourceInClassRequest($resource, $edu_resource_use_in_class, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'useEduResourceInClass' + * + * @param string $resource Unique identifier of the resource (required) + * @param \Flat\APIClient\Model\EduResourceUseInClass $edu_resource_use_in_class (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['useEduResourceInClass'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function useEduResourceInClassRequest( + string $resource, + \Flat\APIClient\Model\EduResourceUseInClass $edu_resource_use_in_class, + string $contentType = self::contentTypes['useEduResourceInClass'][0] + ): Request + { + // verify the required parameter 'resource' is set + if ($resource === null || (is_array($resource) && count($resource) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $resource when calling useEduResourceInClass' + ); + } + // verify the required parameter 'edu_resource_use_in_class' is set + if ($edu_resource_use_in_class === null || (is_array($edu_resource_use_in_class) && count($edu_resource_use_in_class) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $edu_resource_use_in_class when calling useEduResourceInClass' + ); + } + + $resourcePath = '/eduResources/{resource}/useInClass'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($resource !== null) { + $resourcePath = str_replace( + '{resource}', + ObjectSerializer::toPathValue($resource), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($edu_resource_use_in_class)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($edu_resource_use_in_class)); + } else { + $httpBody = $edu_resource_use_in_class; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/src/Api/GroupApi.php b/src/Api/GroupApi.php new file mode 100644 index 0000000..1f6c59f --- /dev/null +++ b/src/Api/GroupApi.php @@ -0,0 +1,3015 @@ + $contentTypes **/ + public const contentTypes = [ + 'addGroupUser' => [ + 'application/json', + ], + 'createGroup' => [ + 'application/json', + ], + 'deleteGroup' => [ + 'application/json', + ], + 'getGroupDetails' => [ + 'application/json', + ], + 'getGroupScores' => [ + 'application/json', + ], + 'listGroupUsers' => [ + 'application/json', + ], + 'listGroups' => [ + 'application/json', + ], + 'removeGroupUser' => [ + 'application/json', + ], + 'renameGroup' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation addGroupUser + * + * Add a student to a group + * + * @param string $group Unique identifier of a Flat group (required) + * @param \Flat\APIClient\Model\AddGroupUserRequest $add_group_user_request add_group_user_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addGroupUser'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\AddGroupUser200Response|\Flat\APIClient\Model\FlatErrorResponse + */ + public function addGroupUser( + string $group, + \Flat\APIClient\Model\AddGroupUserRequest $add_group_user_request, + string $contentType = self::contentTypes['addGroupUser'][0] + ): \Flat\APIClient\Model\AddGroupUser200Response|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->addGroupUserWithHttpInfo($group, $add_group_user_request, $contentType); + return $response; + } + + /** + * Operation addGroupUserWithHttpInfo + * + * Add a student to a group + * + * @param string $group Unique identifier of a Flat group (required) + * @param \Flat\APIClient\Model\AddGroupUserRequest $add_group_user_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addGroupUser'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\AddGroupUser200Response|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function addGroupUserWithHttpInfo( + string $group, + \Flat\APIClient\Model\AddGroupUserRequest $add_group_user_request, + string $contentType = self::contentTypes['addGroupUser'][0] + ): array + { + $request = $this->addGroupUserRequest($group, $add_group_user_request, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AddGroupUser200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AddGroupUser200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\AddGroupUser200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation addGroupUserAsync + * + * Add a student to a group + * + * @param string $group Unique identifier of a Flat group (required) + * @param \Flat\APIClient\Model\AddGroupUserRequest $add_group_user_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addGroupUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function addGroupUserAsync( + string $group, + \Flat\APIClient\Model\AddGroupUserRequest $add_group_user_request, + string $contentType = self::contentTypes['addGroupUser'][0] + ): PromiseInterface + { + return $this->addGroupUserAsyncWithHttpInfo($group, $add_group_user_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addGroupUserAsyncWithHttpInfo + * + * Add a student to a group + * + * @param string $group Unique identifier of a Flat group (required) + * @param \Flat\APIClient\Model\AddGroupUserRequest $add_group_user_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addGroupUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function addGroupUserAsyncWithHttpInfo( + string $group, + \Flat\APIClient\Model\AddGroupUserRequest $add_group_user_request, + string $contentType = self::contentTypes['addGroupUser'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\AddGroupUser200Response'; + $request = $this->addGroupUserRequest($group, $add_group_user_request, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'addGroupUser' + * + * @param string $group Unique identifier of a Flat group (required) + * @param \Flat\APIClient\Model\AddGroupUserRequest $add_group_user_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addGroupUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function addGroupUserRequest( + string $group, + \Flat\APIClient\Model\AddGroupUserRequest $add_group_user_request, + string $contentType = self::contentTypes['addGroupUser'][0] + ): Request + { + // verify the required parameter 'group' is set + if ($group === null || (is_array($group) && count($group) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $group when calling addGroupUser' + ); + } + // verify the required parameter 'add_group_user_request' is set + if ($add_group_user_request === null || (is_array($add_group_user_request) && count($add_group_user_request) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $add_group_user_request when calling addGroupUser' + ); + } + + $resourcePath = '/groups/{group}/users'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($group !== null) { + $resourcePath = str_replace( + '{group}', + ObjectSerializer::toPathValue($group), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($add_group_user_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($add_group_user_request)); + } else { + $httpBody = $add_group_user_request; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createGroup + * + * Create a new group + * + * @param \Flat\APIClient\Model\GroupCreation $group_creation group_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\GroupDetails|\Flat\APIClient\Model\FlatErrorResponse + */ + public function createGroup( + \Flat\APIClient\Model\GroupCreation $group_creation, + string $contentType = self::contentTypes['createGroup'][0] + ): \Flat\APIClient\Model\GroupDetails|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->createGroupWithHttpInfo($group_creation, $contentType); + return $response; + } + + /** + * Operation createGroupWithHttpInfo + * + * Create a new group + * + * @param \Flat\APIClient\Model\GroupCreation $group_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\GroupDetails|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createGroupWithHttpInfo( + \Flat\APIClient\Model\GroupCreation $group_creation, + string $contentType = self::contentTypes['createGroup'][0] + ): array + { + $request = $this->createGroupRequest($group_creation, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\GroupDetails', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 409: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\GroupDetails', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\GroupDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createGroupAsync + * + * Create a new group + * + * @param \Flat\APIClient\Model\GroupCreation $group_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createGroupAsync( + \Flat\APIClient\Model\GroupCreation $group_creation, + string $contentType = self::contentTypes['createGroup'][0] + ): PromiseInterface + { + return $this->createGroupAsyncWithHttpInfo($group_creation, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createGroupAsyncWithHttpInfo + * + * Create a new group + * + * @param \Flat\APIClient\Model\GroupCreation $group_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createGroupAsyncWithHttpInfo( + \Flat\APIClient\Model\GroupCreation $group_creation, + string $contentType = self::contentTypes['createGroup'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\GroupDetails'; + $request = $this->createGroupRequest($group_creation, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createGroup' + * + * @param \Flat\APIClient\Model\GroupCreation $group_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createGroupRequest( + \Flat\APIClient\Model\GroupCreation $group_creation, + string $contentType = self::contentTypes['createGroup'][0] + ): Request + { + // verify the required parameter 'group_creation' is set + if ($group_creation === null || (is_array($group_creation) && count($group_creation) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $group_creation when calling createGroup' + ); + } + + $resourcePath = '/groups'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($group_creation)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($group_creation)); + } else { + $httpBody = $group_creation; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteGroup + * + * Delete a group + * + * @param string $group Unique identifier of a Flat group (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\FlatErrorResponse|null + */ + public function deleteGroup( + string $group, + string $contentType = self::contentTypes['deleteGroup'][0] + ): ?\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->deleteGroupWithHttpInfo($group, $contentType); + return $response; + } + + /** + * Operation deleteGroupWithHttpInfo + * + * Delete a group + * + * @param string $group Unique identifier of a Flat group (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function deleteGroupWithHttpInfo( + string $group, + string $contentType = self::contentTypes['deleteGroup'][0] + ): array + { + $request = $this->deleteGroupRequest($group, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation deleteGroupAsync + * + * Delete a group + * + * @param string $group Unique identifier of a Flat group (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteGroupAsync( + string $group, + string $contentType = self::contentTypes['deleteGroup'][0] + ): PromiseInterface + { + return $this->deleteGroupAsyncWithHttpInfo($group, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteGroupAsyncWithHttpInfo + * + * Delete a group + * + * @param string $group Unique identifier of a Flat group (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteGroupAsyncWithHttpInfo( + string $group, + string $contentType = self::contentTypes['deleteGroup'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deleteGroupRequest($group, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteGroup' + * + * @param string $group Unique identifier of a Flat group (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteGroupRequest( + string $group, + string $contentType = self::contentTypes['deleteGroup'][0] + ): Request + { + // verify the required parameter 'group' is set + if ($group === null || (is_array($group) && count($group) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $group when calling deleteGroup' + ); + } + + $resourcePath = '/groups/{group}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($group !== null) { + $resourcePath = str_replace( + '{group}', + ObjectSerializer::toPathValue($group), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getGroupDetails + * + * Get group information + * + * @param string $group Unique identifier of a Flat group (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupDetails'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\GroupDetails|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getGroupDetails( + string $group, + string $contentType = self::contentTypes['getGroupDetails'][0] + ): \Flat\APIClient\Model\GroupDetails|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getGroupDetailsWithHttpInfo($group, $contentType); + return $response; + } + + /** + * Operation getGroupDetailsWithHttpInfo + * + * Get group information + * + * @param string $group Unique identifier of a Flat group (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupDetails'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\GroupDetails|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getGroupDetailsWithHttpInfo( + string $group, + string $contentType = self::contentTypes['getGroupDetails'][0] + ): array + { + $request = $this->getGroupDetailsRequest($group, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\GroupDetails', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\GroupDetails', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\GroupDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getGroupDetailsAsync + * + * Get group information + * + * @param string $group Unique identifier of a Flat group (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupDetails'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getGroupDetailsAsync( + string $group, + string $contentType = self::contentTypes['getGroupDetails'][0] + ): PromiseInterface + { + return $this->getGroupDetailsAsyncWithHttpInfo($group, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getGroupDetailsAsyncWithHttpInfo + * + * Get group information + * + * @param string $group Unique identifier of a Flat group (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupDetails'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getGroupDetailsAsyncWithHttpInfo( + string $group, + string $contentType = self::contentTypes['getGroupDetails'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\GroupDetails'; + $request = $this->getGroupDetailsRequest($group, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getGroupDetails' + * + * @param string $group Unique identifier of a Flat group (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupDetails'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getGroupDetailsRequest( + string $group, + string $contentType = self::contentTypes['getGroupDetails'][0] + ): Request + { + // verify the required parameter 'group' is set + if ($group === null || (is_array($group) && count($group) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $group when calling getGroupDetails' + ); + } + + $resourcePath = '/groups/{group}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($group !== null) { + $resourcePath = str_replace( + '{group}', + ObjectSerializer::toPathValue($group), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getGroupScores + * + * List group's scores + * + * @param string $group Unique identifier of a Flat group (required) + * @param string|null $parent Filter the score forked from the score id `parent` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupScores'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ScoreDetails[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getGroupScores( + string $group, + ?string $parent = null, + string $contentType = self::contentTypes['getGroupScores'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getGroupScoresWithHttpInfo($group, $parent, $contentType); + return $response; + } + + /** + * Operation getGroupScoresWithHttpInfo + * + * List group's scores + * + * @param string $group Unique identifier of a Flat group (required) + * @param string|null $parent Filter the score forked from the score id `parent` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupScores'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ScoreDetails[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getGroupScoresWithHttpInfo( + string $group, + ?string $parent = null, + string $contentType = self::contentTypes['getGroupScores'][0] + ): array + { + $request = $this->getGroupScoresRequest($group, $parent, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails[]', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ScoreDetails[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getGroupScoresAsync + * + * List group's scores + * + * @param string $group Unique identifier of a Flat group (required) + * @param string|null $parent Filter the score forked from the score id `parent` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupScores'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getGroupScoresAsync( + string $group, + ?string $parent = null, + string $contentType = self::contentTypes['getGroupScores'][0] + ): PromiseInterface + { + return $this->getGroupScoresAsyncWithHttpInfo($group, $parent, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getGroupScoresAsyncWithHttpInfo + * + * List group's scores + * + * @param string $group Unique identifier of a Flat group (required) + * @param string|null $parent Filter the score forked from the score id `parent` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupScores'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getGroupScoresAsyncWithHttpInfo( + string $group, + ?string $parent = null, + string $contentType = self::contentTypes['getGroupScores'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ScoreDetails[]'; + $request = $this->getGroupScoresRequest($group, $parent, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getGroupScores' + * + * @param string $group Unique identifier of a Flat group (required) + * @param string|null $parent Filter the score forked from the score id `parent` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupScores'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getGroupScoresRequest( + string $group, + ?string $parent = null, + string $contentType = self::contentTypes['getGroupScores'][0] + ): Request + { + // verify the required parameter 'group' is set + if ($group === null || (is_array($group) && count($group) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $group when calling getGroupScores' + ); + } + + $resourcePath = '/groups/{group}/scores'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $parent, + 'parent', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($group !== null) { + $resourcePath = str_replace( + '{group}', + ObjectSerializer::toPathValue($group), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listGroupUsers + * + * List group's users + * + * @param string $group Unique identifier of a Flat group (required) + * @param string|null $source Filter the users by their source (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listGroupUsers'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\UserPublic[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function listGroupUsers( + string $group, + ?string $source = null, + string $contentType = self::contentTypes['listGroupUsers'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->listGroupUsersWithHttpInfo($group, $source, $contentType); + return $response; + } + + /** + * Operation listGroupUsersWithHttpInfo + * + * List group's users + * + * @param string $group Unique identifier of a Flat group (required) + * @param string|null $source Filter the users by their source (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listGroupUsers'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\UserPublic[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listGroupUsersWithHttpInfo( + string $group, + ?string $source = null, + string $contentType = self::contentTypes['listGroupUsers'][0] + ): array + { + $request = $this->listGroupUsersRequest($group, $source, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\UserPublic[]', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\UserPublic[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\UserPublic[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listGroupUsersAsync + * + * List group's users + * + * @param string $group Unique identifier of a Flat group (required) + * @param string|null $source Filter the users by their source (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listGroupUsers'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listGroupUsersAsync( + string $group, + ?string $source = null, + string $contentType = self::contentTypes['listGroupUsers'][0] + ): PromiseInterface + { + return $this->listGroupUsersAsyncWithHttpInfo($group, $source, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listGroupUsersAsyncWithHttpInfo + * + * List group's users + * + * @param string $group Unique identifier of a Flat group (required) + * @param string|null $source Filter the users by their source (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listGroupUsers'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listGroupUsersAsyncWithHttpInfo( + string $group, + ?string $source = null, + string $contentType = self::contentTypes['listGroupUsers'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\UserPublic[]'; + $request = $this->listGroupUsersRequest($group, $source, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listGroupUsers' + * + * @param string $group Unique identifier of a Flat group (required) + * @param string|null $source Filter the users by their source (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listGroupUsers'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listGroupUsersRequest( + string $group, + ?string $source = null, + string $contentType = self::contentTypes['listGroupUsers'][0] + ): Request + { + // verify the required parameter 'group' is set + if ($group === null || (is_array($group) && count($group) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $group when calling listGroupUsers' + ); + } + + $resourcePath = '/groups/{group}/users'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $source, + 'source', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($group !== null) { + $resourcePath = str_replace( + '{group}', + ObjectSerializer::toPathValue($group), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listGroups + * + * List groups + * + * @param string $type type (required) + * @param string|null $classroom Classroom ID to filter by (optional) + * @param string|null $assignment Assignment ID to filter by (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listGroups'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\GroupDetails[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function listGroups( + string $type, + ?string $classroom = null, + ?string $assignment = null, + string $contentType = self::contentTypes['listGroups'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->listGroupsWithHttpInfo($type, $classroom, $assignment, $contentType); + return $response; + } + + /** + * Operation listGroupsWithHttpInfo + * + * List groups + * + * @param string $type (required) + * @param string|null $classroom Classroom ID to filter by (optional) + * @param string|null $assignment Assignment ID to filter by (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listGroups'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\GroupDetails[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listGroupsWithHttpInfo( + string $type, + ?string $classroom = null, + ?string $assignment = null, + string $contentType = self::contentTypes['listGroups'][0] + ): array + { + $request = $this->listGroupsRequest($type, $classroom, $assignment, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\GroupDetails[]', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\GroupDetails[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\GroupDetails[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listGroupsAsync + * + * List groups + * + * @param string $type (required) + * @param string|null $classroom Classroom ID to filter by (optional) + * @param string|null $assignment Assignment ID to filter by (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listGroups'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listGroupsAsync( + string $type, + ?string $classroom = null, + ?string $assignment = null, + string $contentType = self::contentTypes['listGroups'][0] + ): PromiseInterface + { + return $this->listGroupsAsyncWithHttpInfo($type, $classroom, $assignment, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listGroupsAsyncWithHttpInfo + * + * List groups + * + * @param string $type (required) + * @param string|null $classroom Classroom ID to filter by (optional) + * @param string|null $assignment Assignment ID to filter by (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listGroups'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listGroupsAsyncWithHttpInfo( + string $type, + ?string $classroom = null, + ?string $assignment = null, + string $contentType = self::contentTypes['listGroups'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\GroupDetails[]'; + $request = $this->listGroupsRequest($type, $classroom, $assignment, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listGroups' + * + * @param string $type (required) + * @param string|null $classroom Classroom ID to filter by (optional) + * @param string|null $assignment Assignment ID to filter by (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listGroups'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listGroupsRequest( + string $type, + ?string $classroom = null, + ?string $assignment = null, + string $contentType = self::contentTypes['listGroups'][0] + ): Request + { + // verify the required parameter 'type' is set + if ($type === null || (is_array($type) && count($type) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $type when calling listGroups' + ); + } + + $resourcePath = '/groups'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $type, + 'type', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $classroom, + 'classroom', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $assignment, + 'assignment', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation removeGroupUser + * + * Remove a student from a class group + * + * @param string $group Unique identifier of a Flat group (required) + * @param string $user User ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeGroupUser'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\FlatErrorResponse|null + */ + public function removeGroupUser( + string $group, + string $user, + string $contentType = self::contentTypes['removeGroupUser'][0] + ): ?\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->removeGroupUserWithHttpInfo($group, $user, $contentType); + return $response; + } + + /** + * Operation removeGroupUserWithHttpInfo + * + * Remove a student from a class group + * + * @param string $group Unique identifier of a Flat group (required) + * @param string $user User ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeGroupUser'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function removeGroupUserWithHttpInfo( + string $group, + string $user, + string $contentType = self::contentTypes['removeGroupUser'][0] + ): array + { + $request = $this->removeGroupUserRequest($group, $user, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation removeGroupUserAsync + * + * Remove a student from a class group + * + * @param string $group Unique identifier of a Flat group (required) + * @param string $user User ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeGroupUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function removeGroupUserAsync( + string $group, + string $user, + string $contentType = self::contentTypes['removeGroupUser'][0] + ): PromiseInterface + { + return $this->removeGroupUserAsyncWithHttpInfo($group, $user, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation removeGroupUserAsyncWithHttpInfo + * + * Remove a student from a class group + * + * @param string $group Unique identifier of a Flat group (required) + * @param string $user User ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeGroupUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function removeGroupUserAsyncWithHttpInfo( + string $group, + string $user, + string $contentType = self::contentTypes['removeGroupUser'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->removeGroupUserRequest($group, $user, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'removeGroupUser' + * + * @param string $group Unique identifier of a Flat group (required) + * @param string $user User ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeGroupUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function removeGroupUserRequest( + string $group, + string $user, + string $contentType = self::contentTypes['removeGroupUser'][0] + ): Request + { + // verify the required parameter 'group' is set + if ($group === null || (is_array($group) && count($group) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $group when calling removeGroupUser' + ); + } + // verify the required parameter 'user' is set + if ($user === null || (is_array($user) && count($user) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $user when calling removeGroupUser' + ); + } + + $resourcePath = '/groups/{group}/users/{user}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($group !== null) { + $resourcePath = str_replace( + '{group}', + ObjectSerializer::toPathValue($group), + $resourcePath + ); + } + // path params + if ($user !== null) { + $resourcePath = str_replace( + '{user}', + ObjectSerializer::toPathValue($user), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation renameGroup + * + * Rename a group + * + * @param string $group Unique identifier of a Flat group (required) + * @param \Flat\APIClient\Model\RenameGroupRequest $rename_group_request rename_group_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['renameGroup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\GroupDetails|\Flat\APIClient\Model\FlatErrorResponse + */ + public function renameGroup( + string $group, + \Flat\APIClient\Model\RenameGroupRequest $rename_group_request, + string $contentType = self::contentTypes['renameGroup'][0] + ): \Flat\APIClient\Model\GroupDetails|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->renameGroupWithHttpInfo($group, $rename_group_request, $contentType); + return $response; + } + + /** + * Operation renameGroupWithHttpInfo + * + * Rename a group + * + * @param string $group Unique identifier of a Flat group (required) + * @param \Flat\APIClient\Model\RenameGroupRequest $rename_group_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['renameGroup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\GroupDetails|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function renameGroupWithHttpInfo( + string $group, + \Flat\APIClient\Model\RenameGroupRequest $rename_group_request, + string $contentType = self::contentTypes['renameGroup'][0] + ): array + { + $request = $this->renameGroupRequest($group, $rename_group_request, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\GroupDetails', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 409: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\GroupDetails', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\GroupDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation renameGroupAsync + * + * Rename a group + * + * @param string $group Unique identifier of a Flat group (required) + * @param \Flat\APIClient\Model\RenameGroupRequest $rename_group_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['renameGroup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function renameGroupAsync( + string $group, + \Flat\APIClient\Model\RenameGroupRequest $rename_group_request, + string $contentType = self::contentTypes['renameGroup'][0] + ): PromiseInterface + { + return $this->renameGroupAsyncWithHttpInfo($group, $rename_group_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation renameGroupAsyncWithHttpInfo + * + * Rename a group + * + * @param string $group Unique identifier of a Flat group (required) + * @param \Flat\APIClient\Model\RenameGroupRequest $rename_group_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['renameGroup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function renameGroupAsyncWithHttpInfo( + string $group, + \Flat\APIClient\Model\RenameGroupRequest $rename_group_request, + string $contentType = self::contentTypes['renameGroup'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\GroupDetails'; + $request = $this->renameGroupRequest($group, $rename_group_request, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'renameGroup' + * + * @param string $group Unique identifier of a Flat group (required) + * @param \Flat\APIClient\Model\RenameGroupRequest $rename_group_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['renameGroup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function renameGroupRequest( + string $group, + \Flat\APIClient\Model\RenameGroupRequest $rename_group_request, + string $contentType = self::contentTypes['renameGroup'][0] + ): Request + { + // verify the required parameter 'group' is set + if ($group === null || (is_array($group) && count($group) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $group when calling renameGroup' + ); + } + // verify the required parameter 'rename_group_request' is set + if ($rename_group_request === null || (is_array($rename_group_request) && count($rename_group_request) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $rename_group_request when calling renameGroup' + ); + } + + $resourcePath = '/groups/{group}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($group !== null) { + $resourcePath = str_replace( + '{group}', + ObjectSerializer::toPathValue($group), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($rename_group_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($rename_group_request)); + } else { + $httpBody = $rename_group_request; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/src/Api/OMRApi.php b/src/Api/OMRApi.php new file mode 100644 index 0000000..4dd9db9 --- /dev/null +++ b/src/Api/OMRApi.php @@ -0,0 +1,4120 @@ + $contentTypes **/ + public const contentTypes = [ + 'addOmrJobFile' => [ + 'application/json', + ], + 'cancelOmrJob' => [ + 'application/json', + ], + 'createOmrJob' => [ + 'application/json', + ], + 'deleteOmrJob' => [ + 'application/json', + ], + 'getOmrCapabilities' => [ + 'application/json', + ], + 'getOmrJob' => [ + 'application/json', + ], + 'getOmrJobExport' => [ + 'application/json', + ], + 'getOmrJobFile' => [ + 'application/json', + ], + 'listBillingCreditsHistory' => [ + 'application/json', + ], + 'listOmrJobs' => [ + 'application/json', + ], + 'startOmrJob' => [ + 'application/json', + ], + 'submitOmrJobStep' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation addOmrJobFile + * + * Add a file to an OMR job + * + * @param string $job Unique identifier of the OMR job (required) + * @param \Flat\APIClient\Model\OmrJobFileUpload $omr_job_file_upload omr_job_file_upload (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addOmrJobFile'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\OmrJobFileUploadResult|\Flat\APIClient\Model\FlatErrorResponse + */ + public function addOmrJobFile( + string $job, + \Flat\APIClient\Model\OmrJobFileUpload $omr_job_file_upload, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['addOmrJobFile'][0] + ): \Flat\APIClient\Model\OmrJobFileUploadResult|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->addOmrJobFileWithHttpInfo($job, $omr_job_file_upload, $x_flat_locale, $contentType); + return $response; + } + + /** + * Operation addOmrJobFileWithHttpInfo + * + * Add a file to an OMR job + * + * @param string $job Unique identifier of the OMR job (required) + * @param \Flat\APIClient\Model\OmrJobFileUpload $omr_job_file_upload (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addOmrJobFile'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\OmrJobFileUploadResult|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function addOmrJobFileWithHttpInfo( + string $job, + \Flat\APIClient\Model\OmrJobFileUpload $omr_job_file_upload, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['addOmrJobFile'][0] + ): array + { + $request = $this->addOmrJobFileRequest($job, $omr_job_file_upload, $x_flat_locale, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\OmrJobFileUploadResult', + $request, + $response, + ); + case 409: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\OmrJobFileUploadResult', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\OmrJobFileUploadResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation addOmrJobFileAsync + * + * Add a file to an OMR job + * + * @param string $job Unique identifier of the OMR job (required) + * @param \Flat\APIClient\Model\OmrJobFileUpload $omr_job_file_upload (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addOmrJobFile'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function addOmrJobFileAsync( + string $job, + \Flat\APIClient\Model\OmrJobFileUpload $omr_job_file_upload, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['addOmrJobFile'][0] + ): PromiseInterface + { + return $this->addOmrJobFileAsyncWithHttpInfo($job, $omr_job_file_upload, $x_flat_locale, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addOmrJobFileAsyncWithHttpInfo + * + * Add a file to an OMR job + * + * @param string $job Unique identifier of the OMR job (required) + * @param \Flat\APIClient\Model\OmrJobFileUpload $omr_job_file_upload (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addOmrJobFile'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function addOmrJobFileAsyncWithHttpInfo( + string $job, + \Flat\APIClient\Model\OmrJobFileUpload $omr_job_file_upload, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['addOmrJobFile'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\OmrJobFileUploadResult'; + $request = $this->addOmrJobFileRequest($job, $omr_job_file_upload, $x_flat_locale, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'addOmrJobFile' + * + * @param string $job Unique identifier of the OMR job (required) + * @param \Flat\APIClient\Model\OmrJobFileUpload $omr_job_file_upload (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addOmrJobFile'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function addOmrJobFileRequest( + string $job, + \Flat\APIClient\Model\OmrJobFileUpload $omr_job_file_upload, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['addOmrJobFile'][0] + ): Request + { + // verify the required parameter 'job' is set + if ($job === null || (is_array($job) && count($job) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $job when calling addOmrJobFile' + ); + } + // verify the required parameter 'omr_job_file_upload' is set + if ($omr_job_file_upload === null || (is_array($omr_job_file_upload) && count($omr_job_file_upload) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $omr_job_file_upload when calling addOmrJobFile' + ); + } + + $resourcePath = '/omr/jobs/{job}/files'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // header params + if ($x_flat_locale !== null) { + $headerParams['X-Flat-Locale'] = ObjectSerializer::toHeaderValue($x_flat_locale); + } + + // path params + if ($job !== null) { + $resourcePath = str_replace( + '{job}', + ObjectSerializer::toPathValue($job), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($omr_job_file_upload)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($omr_job_file_upload)); + } else { + $httpBody = $omr_job_file_upload; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation cancelOmrJob + * + * Cancel an OMR job + * + * @param string $job Unique identifier of the OMR job (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelOmrJob'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\OmrJob|\Flat\APIClient\Model\FlatErrorResponse + */ + public function cancelOmrJob( + string $job, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['cancelOmrJob'][0] + ): \Flat\APIClient\Model\OmrJob|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->cancelOmrJobWithHttpInfo($job, $x_flat_locale, $contentType); + return $response; + } + + /** + * Operation cancelOmrJobWithHttpInfo + * + * Cancel an OMR job + * + * @param string $job Unique identifier of the OMR job (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelOmrJob'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\OmrJob|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function cancelOmrJobWithHttpInfo( + string $job, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['cancelOmrJob'][0] + ): array + { + $request = $this->cancelOmrJobRequest($job, $x_flat_locale, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\OmrJob', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\OmrJob', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\OmrJob', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation cancelOmrJobAsync + * + * Cancel an OMR job + * + * @param string $job Unique identifier of the OMR job (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelOmrJob'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function cancelOmrJobAsync( + string $job, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['cancelOmrJob'][0] + ): PromiseInterface + { + return $this->cancelOmrJobAsyncWithHttpInfo($job, $x_flat_locale, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation cancelOmrJobAsyncWithHttpInfo + * + * Cancel an OMR job + * + * @param string $job Unique identifier of the OMR job (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelOmrJob'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function cancelOmrJobAsyncWithHttpInfo( + string $job, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['cancelOmrJob'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\OmrJob'; + $request = $this->cancelOmrJobRequest($job, $x_flat_locale, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'cancelOmrJob' + * + * @param string $job Unique identifier of the OMR job (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelOmrJob'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function cancelOmrJobRequest( + string $job, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['cancelOmrJob'][0] + ): Request + { + // verify the required parameter 'job' is set + if ($job === null || (is_array($job) && count($job) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $job when calling cancelOmrJob' + ); + } + + $resourcePath = '/omr/jobs/{job}/cancel'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // header params + if ($x_flat_locale !== null) { + $headerParams['X-Flat-Locale'] = ObjectSerializer::toHeaderValue($x_flat_locale); + } + + // path params + if ($job !== null) { + $resourcePath = str_replace( + '{job}', + ObjectSerializer::toPathValue($job), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createOmrJob + * + * Create an OMR job + * + * @param \Flat\APIClient\Model\OmrJobCreation $omr_job_creation omr_job_creation (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOmrJob'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\OmrJob|\Flat\APIClient\Model\FlatErrorResponse + */ + public function createOmrJob( + \Flat\APIClient\Model\OmrJobCreation $omr_job_creation, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['createOmrJob'][0] + ): \Flat\APIClient\Model\OmrJob|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->createOmrJobWithHttpInfo($omr_job_creation, $x_flat_locale, $contentType); + return $response; + } + + /** + * Operation createOmrJobWithHttpInfo + * + * Create an OMR job + * + * @param \Flat\APIClient\Model\OmrJobCreation $omr_job_creation (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOmrJob'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\OmrJob|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createOmrJobWithHttpInfo( + \Flat\APIClient\Model\OmrJobCreation $omr_job_creation, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['createOmrJob'][0] + ): array + { + $request = $this->createOmrJobRequest($omr_job_creation, $x_flat_locale, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\OmrJob', + $request, + $response, + ); + case 202: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\OmrJob', + $request, + $response, + ); + case 402: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\OmrJob', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\OmrJob', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\OmrJob', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createOmrJobAsync + * + * Create an OMR job + * + * @param \Flat\APIClient\Model\OmrJobCreation $omr_job_creation (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOmrJob'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createOmrJobAsync( + \Flat\APIClient\Model\OmrJobCreation $omr_job_creation, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['createOmrJob'][0] + ): PromiseInterface + { + return $this->createOmrJobAsyncWithHttpInfo($omr_job_creation, $x_flat_locale, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createOmrJobAsyncWithHttpInfo + * + * Create an OMR job + * + * @param \Flat\APIClient\Model\OmrJobCreation $omr_job_creation (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOmrJob'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createOmrJobAsyncWithHttpInfo( + \Flat\APIClient\Model\OmrJobCreation $omr_job_creation, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['createOmrJob'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\OmrJob'; + $request = $this->createOmrJobRequest($omr_job_creation, $x_flat_locale, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createOmrJob' + * + * @param \Flat\APIClient\Model\OmrJobCreation $omr_job_creation (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOmrJob'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createOmrJobRequest( + \Flat\APIClient\Model\OmrJobCreation $omr_job_creation, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['createOmrJob'][0] + ): Request + { + // verify the required parameter 'omr_job_creation' is set + if ($omr_job_creation === null || (is_array($omr_job_creation) && count($omr_job_creation) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $omr_job_creation when calling createOmrJob' + ); + } + + $resourcePath = '/omr/jobs'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // header params + if ($x_flat_locale !== null) { + $headerParams['X-Flat-Locale'] = ObjectSerializer::toHeaderValue($x_flat_locale); + } + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($omr_job_creation)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($omr_job_creation)); + } else { + $httpBody = $omr_job_creation; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteOmrJob + * + * Delete an OMR job's data + * + * @param string $job Unique identifier of the OMR job (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteOmrJob'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\OmrJob|\Flat\APIClient\Model\FlatErrorResponse + */ + public function deleteOmrJob( + string $job, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['deleteOmrJob'][0] + ): \Flat\APIClient\Model\OmrJob|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->deleteOmrJobWithHttpInfo($job, $x_flat_locale, $contentType); + return $response; + } + + /** + * Operation deleteOmrJobWithHttpInfo + * + * Delete an OMR job's data + * + * @param string $job Unique identifier of the OMR job (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteOmrJob'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\OmrJob|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function deleteOmrJobWithHttpInfo( + string $job, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['deleteOmrJob'][0] + ): array + { + $request = $this->deleteOmrJobRequest($job, $x_flat_locale, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\OmrJob', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 409: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\OmrJob', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\OmrJob', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation deleteOmrJobAsync + * + * Delete an OMR job's data + * + * @param string $job Unique identifier of the OMR job (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteOmrJob'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteOmrJobAsync( + string $job, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['deleteOmrJob'][0] + ): PromiseInterface + { + return $this->deleteOmrJobAsyncWithHttpInfo($job, $x_flat_locale, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteOmrJobAsyncWithHttpInfo + * + * Delete an OMR job's data + * + * @param string $job Unique identifier of the OMR job (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteOmrJob'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteOmrJobAsyncWithHttpInfo( + string $job, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['deleteOmrJob'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\OmrJob'; + $request = $this->deleteOmrJobRequest($job, $x_flat_locale, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteOmrJob' + * + * @param string $job Unique identifier of the OMR job (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteOmrJob'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteOmrJobRequest( + string $job, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['deleteOmrJob'][0] + ): Request + { + // verify the required parameter 'job' is set + if ($job === null || (is_array($job) && count($job) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $job when calling deleteOmrJob' + ); + } + + $resourcePath = '/omr/jobs/{job}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // header params + if ($x_flat_locale !== null) { + $headerParams['X-Flat-Locale'] = ObjectSerializer::toHeaderValue($x_flat_locale); + } + + // path params + if ($job !== null) { + $resourcePath = str_replace( + '{job}', + ObjectSerializer::toPathValue($job), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getOmrCapabilities + * + * OMR capabilities and limits + * + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOmrCapabilities'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\OmrCapabilities|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getOmrCapabilities( + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['getOmrCapabilities'][0] + ): \Flat\APIClient\Model\OmrCapabilities|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getOmrCapabilitiesWithHttpInfo($x_flat_locale, $contentType); + return $response; + } + + /** + * Operation getOmrCapabilitiesWithHttpInfo + * + * OMR capabilities and limits + * + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOmrCapabilities'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\OmrCapabilities|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getOmrCapabilitiesWithHttpInfo( + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['getOmrCapabilities'][0] + ): array + { + $request = $this->getOmrCapabilitiesRequest($x_flat_locale, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\OmrCapabilities', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\OmrCapabilities', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\OmrCapabilities', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getOmrCapabilitiesAsync + * + * OMR capabilities and limits + * + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOmrCapabilities'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getOmrCapabilitiesAsync( + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['getOmrCapabilities'][0] + ): PromiseInterface + { + return $this->getOmrCapabilitiesAsyncWithHttpInfo($x_flat_locale, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getOmrCapabilitiesAsyncWithHttpInfo + * + * OMR capabilities and limits + * + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOmrCapabilities'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getOmrCapabilitiesAsyncWithHttpInfo( + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['getOmrCapabilities'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\OmrCapabilities'; + $request = $this->getOmrCapabilitiesRequest($x_flat_locale, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getOmrCapabilities' + * + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOmrCapabilities'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getOmrCapabilitiesRequest( + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['getOmrCapabilities'][0] + ): Request + { + + $resourcePath = '/omr/capabilities'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // header params + if ($x_flat_locale !== null) { + $headerParams['X-Flat-Locale'] = ObjectSerializer::toHeaderValue($x_flat_locale); + } + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getOmrJob + * + * Get an OMR job + * + * @param string $job Unique identifier of the OMR job (required) + * @param int|null $wait Long-poll up to this many seconds for a state change before returning. (optional) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOmrJob'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\OmrJob|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getOmrJob( + string $job, + ?int $wait = null, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['getOmrJob'][0] + ): \Flat\APIClient\Model\OmrJob|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getOmrJobWithHttpInfo($job, $wait, $x_flat_locale, $contentType); + return $response; + } + + /** + * Operation getOmrJobWithHttpInfo + * + * Get an OMR job + * + * @param string $job Unique identifier of the OMR job (required) + * @param int|null $wait Long-poll up to this many seconds for a state change before returning. (optional) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOmrJob'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\OmrJob|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getOmrJobWithHttpInfo( + string $job, + ?int $wait = null, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['getOmrJob'][0] + ): array + { + $request = $this->getOmrJobRequest($job, $wait, $x_flat_locale, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\OmrJob', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\OmrJob', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\OmrJob', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getOmrJobAsync + * + * Get an OMR job + * + * @param string $job Unique identifier of the OMR job (required) + * @param int|null $wait Long-poll up to this many seconds for a state change before returning. (optional) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOmrJob'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getOmrJobAsync( + string $job, + ?int $wait = null, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['getOmrJob'][0] + ): PromiseInterface + { + return $this->getOmrJobAsyncWithHttpInfo($job, $wait, $x_flat_locale, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getOmrJobAsyncWithHttpInfo + * + * Get an OMR job + * + * @param string $job Unique identifier of the OMR job (required) + * @param int|null $wait Long-poll up to this many seconds for a state change before returning. (optional) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOmrJob'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getOmrJobAsyncWithHttpInfo( + string $job, + ?int $wait = null, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['getOmrJob'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\OmrJob'; + $request = $this->getOmrJobRequest($job, $wait, $x_flat_locale, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getOmrJob' + * + * @param string $job Unique identifier of the OMR job (required) + * @param int|null $wait Long-poll up to this many seconds for a state change before returning. (optional) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOmrJob'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getOmrJobRequest( + string $job, + ?int $wait = null, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['getOmrJob'][0] + ): Request + { + // verify the required parameter 'job' is set + if ($job === null || (is_array($job) && count($job) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $job when calling getOmrJob' + ); + } + if ($wait !== null && $wait > 25) { + throw new InvalidArgumentException('invalid value for "$wait" when calling OMRApi.getOmrJob, must be smaller than or equal to 25.'); + } + if ($wait !== null && $wait < 0) { + throw new InvalidArgumentException('invalid value for "$wait" when calling OMRApi.getOmrJob, must be bigger than or equal to 0.'); + } + + $resourcePath = '/omr/jobs/{job}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $wait, + 'wait', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + // header params + if ($x_flat_locale !== null) { + $headerParams['X-Flat-Locale'] = ObjectSerializer::toHeaderValue($x_flat_locale); + } + + // path params + if ($job !== null) { + $resourcePath = str_replace( + '{job}', + ObjectSerializer::toPathValue($job), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getOmrJobExport + * + * Download the finalized result + * + * @param string $job Unique identifier of the OMR job (required) + * @param string $format Export format. New formats may be added over time; request what your client supports. * `musicxml`: Uncompressed MusicXML (plain text `.xml`, `application/vnd.recordare.musicxml+xml`). * `mxl`: Compressed MusicXML (zip archive `.mxl`, `application/vnd.recordare.musicxml`), the same notation as `musicxml` but smaller to download. * `midi`: Standard MIDI file (`.mid`, `audio/midi`). * `thumbnail.png`: PNG preview of the first page (`image/png`). (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOmrJobExport'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \SplFileObject|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getOmrJobExport( + string $job, + string $format, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['getOmrJobExport'][0] + ): \SplFileObject|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getOmrJobExportWithHttpInfo($job, $format, $x_flat_locale, $contentType); + return $response; + } + + /** + * Operation getOmrJobExportWithHttpInfo + * + * Download the finalized result + * + * @param string $job Unique identifier of the OMR job (required) + * @param string $format Export format. New formats may be added over time; request what your client supports. * `musicxml`: Uncompressed MusicXML (plain text `.xml`, `application/vnd.recordare.musicxml+xml`). * `mxl`: Compressed MusicXML (zip archive `.mxl`, `application/vnd.recordare.musicxml`), the same notation as `musicxml` but smaller to download. * `midi`: Standard MIDI file (`.mid`, `audio/midi`). * `thumbnail.png`: PNG preview of the first page (`image/png`). (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOmrJobExport'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \SplFileObject|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getOmrJobExportWithHttpInfo( + string $job, + string $format, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['getOmrJobExport'][0] + ): array + { + $request = $this->getOmrJobExportRequest($job, $format, $x_flat_locale, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\SplFileObject', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 409: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\SplFileObject', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SplFileObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getOmrJobExportAsync + * + * Download the finalized result + * + * @param string $job Unique identifier of the OMR job (required) + * @param string $format Export format. New formats may be added over time; request what your client supports. * `musicxml`: Uncompressed MusicXML (plain text `.xml`, `application/vnd.recordare.musicxml+xml`). * `mxl`: Compressed MusicXML (zip archive `.mxl`, `application/vnd.recordare.musicxml`), the same notation as `musicxml` but smaller to download. * `midi`: Standard MIDI file (`.mid`, `audio/midi`). * `thumbnail.png`: PNG preview of the first page (`image/png`). (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOmrJobExport'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getOmrJobExportAsync( + string $job, + string $format, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['getOmrJobExport'][0] + ): PromiseInterface + { + return $this->getOmrJobExportAsyncWithHttpInfo($job, $format, $x_flat_locale, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getOmrJobExportAsyncWithHttpInfo + * + * Download the finalized result + * + * @param string $job Unique identifier of the OMR job (required) + * @param string $format Export format. New formats may be added over time; request what your client supports. * `musicxml`: Uncompressed MusicXML (plain text `.xml`, `application/vnd.recordare.musicxml+xml`). * `mxl`: Compressed MusicXML (zip archive `.mxl`, `application/vnd.recordare.musicxml`), the same notation as `musicxml` but smaller to download. * `midi`: Standard MIDI file (`.mid`, `audio/midi`). * `thumbnail.png`: PNG preview of the first page (`image/png`). (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOmrJobExport'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getOmrJobExportAsyncWithHttpInfo( + string $job, + string $format, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['getOmrJobExport'][0] + ): PromiseInterface + { + $returnType = '\SplFileObject'; + $request = $this->getOmrJobExportRequest($job, $format, $x_flat_locale, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getOmrJobExport' + * + * @param string $job Unique identifier of the OMR job (required) + * @param string $format Export format. New formats may be added over time; request what your client supports. * `musicxml`: Uncompressed MusicXML (plain text `.xml`, `application/vnd.recordare.musicxml+xml`). * `mxl`: Compressed MusicXML (zip archive `.mxl`, `application/vnd.recordare.musicxml`), the same notation as `musicxml` but smaller to download. * `midi`: Standard MIDI file (`.mid`, `audio/midi`). * `thumbnail.png`: PNG preview of the first page (`image/png`). (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOmrJobExport'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getOmrJobExportRequest( + string $job, + string $format, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['getOmrJobExport'][0] + ): Request + { + // verify the required parameter 'job' is set + if ($job === null || (is_array($job) && count($job) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $job when calling getOmrJobExport' + ); + } + // verify the required parameter 'format' is set + if ($format === null || (is_array($format) && count($format) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $format when calling getOmrJobExport' + ); + } + + $resourcePath = '/omr/jobs/{job}/exports/{format}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // header params + if ($x_flat_locale !== null) { + $headerParams['X-Flat-Locale'] = ObjectSerializer::toHeaderValue($x_flat_locale); + } + + // path params + if ($job !== null) { + $resourcePath = str_replace( + '{job}', + ObjectSerializer::toPathValue($job), + $resourcePath + ); + } + // path params + if ($format !== null) { + $resourcePath = str_replace( + '{format}', + ObjectSerializer::toPathValue($format), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/octet-stream', 'application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getOmrJobFile + * + * Get an input page image + * + * @param string $job Unique identifier of the OMR job (required) + * @param int $index 0-based index of the input file (page) to fetch. (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOmrJobFile'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \SplFileObject|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getOmrJobFile( + string $job, + int $index, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['getOmrJobFile'][0] + ): \SplFileObject|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getOmrJobFileWithHttpInfo($job, $index, $x_flat_locale, $contentType); + return $response; + } + + /** + * Operation getOmrJobFileWithHttpInfo + * + * Get an input page image + * + * @param string $job Unique identifier of the OMR job (required) + * @param int $index 0-based index of the input file (page) to fetch. (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOmrJobFile'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \SplFileObject|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getOmrJobFileWithHttpInfo( + string $job, + int $index, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['getOmrJobFile'][0] + ): array + { + $request = $this->getOmrJobFileRequest($job, $index, $x_flat_locale, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\SplFileObject', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 409: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\SplFileObject', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SplFileObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getOmrJobFileAsync + * + * Get an input page image + * + * @param string $job Unique identifier of the OMR job (required) + * @param int $index 0-based index of the input file (page) to fetch. (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOmrJobFile'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getOmrJobFileAsync( + string $job, + int $index, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['getOmrJobFile'][0] + ): PromiseInterface + { + return $this->getOmrJobFileAsyncWithHttpInfo($job, $index, $x_flat_locale, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getOmrJobFileAsyncWithHttpInfo + * + * Get an input page image + * + * @param string $job Unique identifier of the OMR job (required) + * @param int $index 0-based index of the input file (page) to fetch. (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOmrJobFile'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getOmrJobFileAsyncWithHttpInfo( + string $job, + int $index, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['getOmrJobFile'][0] + ): PromiseInterface + { + $returnType = '\SplFileObject'; + $request = $this->getOmrJobFileRequest($job, $index, $x_flat_locale, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getOmrJobFile' + * + * @param string $job Unique identifier of the OMR job (required) + * @param int $index 0-based index of the input file (page) to fetch. (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOmrJobFile'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getOmrJobFileRequest( + string $job, + int $index, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['getOmrJobFile'][0] + ): Request + { + // verify the required parameter 'job' is set + if ($job === null || (is_array($job) && count($job) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $job when calling getOmrJobFile' + ); + } + // verify the required parameter 'index' is set + if ($index === null || (is_array($index) && count($index) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $index when calling getOmrJobFile' + ); + } + + $resourcePath = '/omr/jobs/{job}/files/{index}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // header params + if ($x_flat_locale !== null) { + $headerParams['X-Flat-Locale'] = ObjectSerializer::toHeaderValue($x_flat_locale); + } + + // path params + if ($job !== null) { + $resourcePath = str_replace( + '{job}', + ObjectSerializer::toPathValue($job), + $resourcePath + ); + } + // path params + if ($index !== null) { + $resourcePath = str_replace( + '{index}', + ObjectSerializer::toPathValue($index), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['image/jpeg', 'application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listBillingCreditsHistory + * + * List credit history + * + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 50) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listBillingCreditsHistory'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\CreditTransaction[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function listBillingCreditsHistory( + ?int $limit = 50, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['listBillingCreditsHistory'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->listBillingCreditsHistoryWithHttpInfo($limit, $next, $previous, $contentType); + return $response; + } + + /** + * Operation listBillingCreditsHistoryWithHttpInfo + * + * List credit history + * + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 50) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listBillingCreditsHistory'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\CreditTransaction[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listBillingCreditsHistoryWithHttpInfo( + ?int $limit = 50, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['listBillingCreditsHistory'][0] + ): array + { + $request = $this->listBillingCreditsHistoryRequest($limit, $next, $previous, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\CreditTransaction[]', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\CreditTransaction[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\CreditTransaction[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listBillingCreditsHistoryAsync + * + * List credit history + * + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 50) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listBillingCreditsHistory'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listBillingCreditsHistoryAsync( + ?int $limit = 50, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['listBillingCreditsHistory'][0] + ): PromiseInterface + { + return $this->listBillingCreditsHistoryAsyncWithHttpInfo($limit, $next, $previous, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listBillingCreditsHistoryAsyncWithHttpInfo + * + * List credit history + * + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 50) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listBillingCreditsHistory'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listBillingCreditsHistoryAsyncWithHttpInfo( + ?int $limit = 50, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['listBillingCreditsHistory'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\CreditTransaction[]'; + $request = $this->listBillingCreditsHistoryRequest($limit, $next, $previous, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listBillingCreditsHistory' + * + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 50) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listBillingCreditsHistory'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listBillingCreditsHistoryRequest( + ?int $limit = 50, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['listBillingCreditsHistory'][0] + ): Request + { + if ($limit !== null && $limit > 1000) { + throw new InvalidArgumentException('invalid value for "$limit" when calling OMRApi.listBillingCreditsHistory, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new InvalidArgumentException('invalid value for "$limit" when calling OMRApi.listBillingCreditsHistory, must be bigger than or equal to 1.'); + } + + $resourcePath = '/billing/credits/history'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $next, + 'next', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $previous, + 'previous', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listOmrJobs + * + * List OMR jobs + * + * @param \Flat\APIClient\Model\OmrJobStatus|null $status Filter jobs by status (optional) + * @param bool|null $expired Filter by data-retention state, independently of `status`. * `true`: only jobs whose files have been erased. * `false`: only jobs that still hold their files. Omit to get both. A job keeps the `status` it finished with after erasure, so this is the only way to tell the two apart. (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 50) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOmrJobs'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\OmrJob[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function listOmrJobs( + ?\Flat\APIClient\Model\OmrJobStatus $status = null, + ?bool $expired = null, + ?int $limit = 50, + ?string $next = null, + ?string $previous = null, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['listOmrJobs'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->listOmrJobsWithHttpInfo($status, $expired, $limit, $next, $previous, $x_flat_locale, $contentType); + return $response; + } + + /** + * Operation listOmrJobsWithHttpInfo + * + * List OMR jobs + * + * @param \Flat\APIClient\Model\OmrJobStatus|null $status Filter jobs by status (optional) + * @param bool|null $expired Filter by data-retention state, independently of `status`. * `true`: only jobs whose files have been erased. * `false`: only jobs that still hold their files. Omit to get both. A job keeps the `status` it finished with after erasure, so this is the only way to tell the two apart. (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 50) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOmrJobs'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\OmrJob[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listOmrJobsWithHttpInfo( + ?\Flat\APIClient\Model\OmrJobStatus $status = null, + ?bool $expired = null, + ?int $limit = 50, + ?string $next = null, + ?string $previous = null, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['listOmrJobs'][0] + ): array + { + $request = $this->listOmrJobsRequest($status, $expired, $limit, $next, $previous, $x_flat_locale, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\OmrJob[]', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\OmrJob[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\OmrJob[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listOmrJobsAsync + * + * List OMR jobs + * + * @param \Flat\APIClient\Model\OmrJobStatus|null $status Filter jobs by status (optional) + * @param bool|null $expired Filter by data-retention state, independently of `status`. * `true`: only jobs whose files have been erased. * `false`: only jobs that still hold their files. Omit to get both. A job keeps the `status` it finished with after erasure, so this is the only way to tell the two apart. (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 50) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOmrJobs'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listOmrJobsAsync( + ?\Flat\APIClient\Model\OmrJobStatus $status = null, + ?bool $expired = null, + ?int $limit = 50, + ?string $next = null, + ?string $previous = null, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['listOmrJobs'][0] + ): PromiseInterface + { + return $this->listOmrJobsAsyncWithHttpInfo($status, $expired, $limit, $next, $previous, $x_flat_locale, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listOmrJobsAsyncWithHttpInfo + * + * List OMR jobs + * + * @param \Flat\APIClient\Model\OmrJobStatus|null $status Filter jobs by status (optional) + * @param bool|null $expired Filter by data-retention state, independently of `status`. * `true`: only jobs whose files have been erased. * `false`: only jobs that still hold their files. Omit to get both. A job keeps the `status` it finished with after erasure, so this is the only way to tell the two apart. (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 50) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOmrJobs'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listOmrJobsAsyncWithHttpInfo( + ?\Flat\APIClient\Model\OmrJobStatus $status = null, + ?bool $expired = null, + ?int $limit = 50, + ?string $next = null, + ?string $previous = null, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['listOmrJobs'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\OmrJob[]'; + $request = $this->listOmrJobsRequest($status, $expired, $limit, $next, $previous, $x_flat_locale, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listOmrJobs' + * + * @param \Flat\APIClient\Model\OmrJobStatus|null $status Filter jobs by status (optional) + * @param bool|null $expired Filter by data-retention state, independently of `status`. * `true`: only jobs whose files have been erased. * `false`: only jobs that still hold their files. Omit to get both. A job keeps the `status` it finished with after erasure, so this is the only way to tell the two apart. (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 50) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOmrJobs'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listOmrJobsRequest( + ?\Flat\APIClient\Model\OmrJobStatus $status = null, + ?bool $expired = null, + ?int $limit = 50, + ?string $next = null, + ?string $previous = null, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['listOmrJobs'][0] + ): Request + { + if ($limit !== null && $limit > 1000) { + throw new InvalidArgumentException('invalid value for "$limit" when calling OMRApi.listOmrJobs, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new InvalidArgumentException('invalid value for "$limit" when calling OMRApi.listOmrJobs, must be bigger than or equal to 1.'); + } + + $resourcePath = '/omr/jobs'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $status?->value, + 'status', // param base name + 'OmrJobStatus', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $expired, + 'expired', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $next, + 'next', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $previous, + 'previous', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + // header params + if ($x_flat_locale !== null) { + $headerParams['X-Flat-Locale'] = ObjectSerializer::toHeaderValue($x_flat_locale); + } + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation startOmrJob + * + * Start an OMR job + * + * @param string $job Unique identifier of the OMR job (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['startOmrJob'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\OmrJob|\Flat\APIClient\Model\FlatErrorResponse + */ + public function startOmrJob( + string $job, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['startOmrJob'][0] + ): \Flat\APIClient\Model\OmrJob|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->startOmrJobWithHttpInfo($job, $x_flat_locale, $contentType); + return $response; + } + + /** + * Operation startOmrJobWithHttpInfo + * + * Start an OMR job + * + * @param string $job Unique identifier of the OMR job (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['startOmrJob'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\OmrJob|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function startOmrJobWithHttpInfo( + string $job, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['startOmrJob'][0] + ): array + { + $request = $this->startOmrJobRequest($job, $x_flat_locale, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 202: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\OmrJob', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 402: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\OmrJob', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\OmrJob', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation startOmrJobAsync + * + * Start an OMR job + * + * @param string $job Unique identifier of the OMR job (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['startOmrJob'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function startOmrJobAsync( + string $job, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['startOmrJob'][0] + ): PromiseInterface + { + return $this->startOmrJobAsyncWithHttpInfo($job, $x_flat_locale, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation startOmrJobAsyncWithHttpInfo + * + * Start an OMR job + * + * @param string $job Unique identifier of the OMR job (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['startOmrJob'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function startOmrJobAsyncWithHttpInfo( + string $job, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['startOmrJob'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\OmrJob'; + $request = $this->startOmrJobRequest($job, $x_flat_locale, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'startOmrJob' + * + * @param string $job Unique identifier of the OMR job (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['startOmrJob'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function startOmrJobRequest( + string $job, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['startOmrJob'][0] + ): Request + { + // verify the required parameter 'job' is set + if ($job === null || (is_array($job) && count($job) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $job when calling startOmrJob' + ); + } + + $resourcePath = '/omr/jobs/{job}/start'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // header params + if ($x_flat_locale !== null) { + $headerParams['X-Flat-Locale'] = ObjectSerializer::toHeaderValue($x_flat_locale); + } + + // path params + if ($job !== null) { + $resourcePath = str_replace( + '{job}', + ObjectSerializer::toPathValue($job), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation submitOmrJobStep + * + * Submit an interactive step + * + * @param string $job Unique identifier of the OMR job (required) + * @param \Flat\APIClient\Model\OmrStepName $step The pending step being submitted (required) + * @param \Flat\APIClient\Model\OmrDetailsSubmission $body body (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitOmrJobStep'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\OmrJob|\Flat\APIClient\Model\FlatErrorResponse + */ + public function submitOmrJobStep( + string $job, + \Flat\APIClient\Model\OmrStepName $step, + \Flat\APIClient\Model\OmrDetailsSubmission $body, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['submitOmrJobStep'][0] + ): \Flat\APIClient\Model\OmrJob|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->submitOmrJobStepWithHttpInfo($job, $step, $body, $x_flat_locale, $contentType); + return $response; + } + + /** + * Operation submitOmrJobStepWithHttpInfo + * + * Submit an interactive step + * + * @param string $job Unique identifier of the OMR job (required) + * @param \Flat\APIClient\Model\OmrStepName $step The pending step being submitted (required) + * @param \Flat\APIClient\Model\OmrDetailsSubmission $body (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitOmrJobStep'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\OmrJob|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function submitOmrJobStepWithHttpInfo( + string $job, + \Flat\APIClient\Model\OmrStepName $step, + \Flat\APIClient\Model\OmrDetailsSubmission $body, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['submitOmrJobStep'][0] + ): array + { + $request = $this->submitOmrJobStepRequest($job, $step, $body, $x_flat_locale, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 202: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\OmrJob', + $request, + $response, + ); + case 409: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\OmrJob', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\OmrJob', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation submitOmrJobStepAsync + * + * Submit an interactive step + * + * @param string $job Unique identifier of the OMR job (required) + * @param \Flat\APIClient\Model\OmrStepName $step The pending step being submitted (required) + * @param \Flat\APIClient\Model\OmrDetailsSubmission $body (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitOmrJobStep'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function submitOmrJobStepAsync( + string $job, + \Flat\APIClient\Model\OmrStepName $step, + \Flat\APIClient\Model\OmrDetailsSubmission $body, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['submitOmrJobStep'][0] + ): PromiseInterface + { + return $this->submitOmrJobStepAsyncWithHttpInfo($job, $step, $body, $x_flat_locale, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation submitOmrJobStepAsyncWithHttpInfo + * + * Submit an interactive step + * + * @param string $job Unique identifier of the OMR job (required) + * @param \Flat\APIClient\Model\OmrStepName $step The pending step being submitted (required) + * @param \Flat\APIClient\Model\OmrDetailsSubmission $body (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitOmrJobStep'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function submitOmrJobStepAsyncWithHttpInfo( + string $job, + \Flat\APIClient\Model\OmrStepName $step, + \Flat\APIClient\Model\OmrDetailsSubmission $body, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['submitOmrJobStep'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\OmrJob'; + $request = $this->submitOmrJobStepRequest($job, $step, $body, $x_flat_locale, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'submitOmrJobStep' + * + * @param string $job Unique identifier of the OMR job (required) + * @param \Flat\APIClient\Model\OmrStepName $step The pending step being submitted (required) + * @param \Flat\APIClient\Model\OmrDetailsSubmission $body (required) + * @param string|null $x_flat_locale Preferred locale for localized content in the response (translated error messages, emails, etc.). Accepts any IETF language tag. The API best-matches the value to a supported locale and never rejects an unknown one (it falls back to the closest match, then to `en`). Supported normalized locales: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ko`, `ms`, `nl`, `nb`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW`. Precedence (highest first): this `X-Flat-Locale` header, the authenticated user's account locale, the `Accept-Language` header, then `en`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitOmrJobStep'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function submitOmrJobStepRequest( + string $job, + \Flat\APIClient\Model\OmrStepName $step, + \Flat\APIClient\Model\OmrDetailsSubmission $body, + ?string $x_flat_locale = null, + string $contentType = self::contentTypes['submitOmrJobStep'][0] + ): Request + { + // verify the required parameter 'job' is set + if ($job === null || (is_array($job) && count($job) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $job when calling submitOmrJobStep' + ); + } + // verify the required parameter 'step' is set + if ($step === null || (is_array($step) && count($step) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $step when calling submitOmrJobStep' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling submitOmrJobStep' + ); + } + + $resourcePath = '/omr/jobs/{job}/steps/{step}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // header params + if ($x_flat_locale !== null) { + $headerParams['X-Flat-Locale'] = ObjectSerializer::toHeaderValue($x_flat_locale); + } + + // path params + if ($job !== null) { + $resourcePath = str_replace( + '{job}', + ObjectSerializer::toPathValue($job), + $resourcePath + ); + } + // path params + if ($step !== null) { + $resourcePath = str_replace( + '{step}', + ObjectSerializer::toPathValue($step->value), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/src/Api/OrganizationApi.php b/src/Api/OrganizationApi.php new file mode 100644 index 0000000..56e535d --- /dev/null +++ b/src/Api/OrganizationApi.php @@ -0,0 +1,5275 @@ + $contentTypes **/ + public const contentTypes = [ + 'countOrgaUsers' => [ + 'application/json', + ], + 'createLtiConfiguration' => [ + 'application/json', + ], + 'createLtiCredentials' => [ + 'application/json', + ], + 'createOrganizationInvitation' => [ + 'application/json', + ], + 'createOrganizationUser' => [ + 'application/json', + ], + 'createOrganizationUserAccessToken' => [ + 'application/json', + ], + 'createOrganizationUserSigninLink' => [ + 'application/json', + ], + 'deleteLtiConfiguration' => [ + 'application/json', + ], + 'listLtiConfigurations' => [ + 'application/json', + ], + 'listLtiCredentials' => [ + 'application/json', + ], + 'listOrganizationInvitations' => [ + 'application/json', + ], + 'listOrganizationUsers' => [ + 'application/json', + ], + 'removeOrganizationInvitation' => [ + 'application/json', + ], + 'removeOrganizationUser' => [ + 'application/json', + ], + 'revokeLtiCredentials' => [ + 'application/json', + ], + 'updateLtiConfiguration' => [ + 'application/json', + ], + 'updateOrganizationUser' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation countOrgaUsers + * + * Count the organization users using the provided filters + * + * @param string[]|null $role Filter users by role (optional) + * @param string|null $q The query to search (optional) + * @param string[]|null $group Filter users by group (optional) + * @param bool|null $no_active_license Filter users who don't have an active license (optional) + * @param string|null $test_accounts Filter users based on test account status. Test accounts are student accounts created for testing purposes by teachers. * `exclude`: Hide test accounts from results. * `only`: Show only test accounts. When omitted, all users are returned. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['countOrgaUsers'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return int|\Flat\APIClient\Model\FlatErrorResponse + */ + public function countOrgaUsers( + ?array $role = null, + ?string $q = null, + ?array $group = null, + ?bool $no_active_license = null, + ?string $test_accounts = null, + string $contentType = self::contentTypes['countOrgaUsers'][0] + ): int|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->countOrgaUsersWithHttpInfo($role, $q, $group, $no_active_license, $test_accounts, $contentType); + return $response; + } + + /** + * Operation countOrgaUsersWithHttpInfo + * + * Count the organization users using the provided filters + * + * @param string[]|null $role Filter users by role (optional) + * @param string|null $q The query to search (optional) + * @param string[]|null $group Filter users by group (optional) + * @param bool|null $no_active_license Filter users who don't have an active license (optional) + * @param string|null $test_accounts Filter users based on test account status. Test accounts are student accounts created for testing purposes by teachers. * `exclude`: Hide test accounts from results. * `only`: Show only test accounts. When omitted, all users are returned. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['countOrgaUsers'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: int|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function countOrgaUsersWithHttpInfo( + ?array $role = null, + ?string $q = null, + ?array $group = null, + ?bool $no_active_license = null, + ?string $test_accounts = null, + string $contentType = self::contentTypes['countOrgaUsers'][0] + ): array + { + $request = $this->countOrgaUsersRequest($role, $q, $group, $no_active_license, $test_accounts, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + 'int', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + 'int', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'int', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation countOrgaUsersAsync + * + * Count the organization users using the provided filters + * + * @param string[]|null $role Filter users by role (optional) + * @param string|null $q The query to search (optional) + * @param string[]|null $group Filter users by group (optional) + * @param bool|null $no_active_license Filter users who don't have an active license (optional) + * @param string|null $test_accounts Filter users based on test account status. Test accounts are student accounts created for testing purposes by teachers. * `exclude`: Hide test accounts from results. * `only`: Show only test accounts. When omitted, all users are returned. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['countOrgaUsers'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function countOrgaUsersAsync( + ?array $role = null, + ?string $q = null, + ?array $group = null, + ?bool $no_active_license = null, + ?string $test_accounts = null, + string $contentType = self::contentTypes['countOrgaUsers'][0] + ): PromiseInterface + { + return $this->countOrgaUsersAsyncWithHttpInfo($role, $q, $group, $no_active_license, $test_accounts, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation countOrgaUsersAsyncWithHttpInfo + * + * Count the organization users using the provided filters + * + * @param string[]|null $role Filter users by role (optional) + * @param string|null $q The query to search (optional) + * @param string[]|null $group Filter users by group (optional) + * @param bool|null $no_active_license Filter users who don't have an active license (optional) + * @param string|null $test_accounts Filter users based on test account status. Test accounts are student accounts created for testing purposes by teachers. * `exclude`: Hide test accounts from results. * `only`: Show only test accounts. When omitted, all users are returned. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['countOrgaUsers'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function countOrgaUsersAsyncWithHttpInfo( + ?array $role = null, + ?string $q = null, + ?array $group = null, + ?bool $no_active_license = null, + ?string $test_accounts = null, + string $contentType = self::contentTypes['countOrgaUsers'][0] + ): PromiseInterface + { + $returnType = 'int'; + $request = $this->countOrgaUsersRequest($role, $q, $group, $no_active_license, $test_accounts, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'countOrgaUsers' + * + * @param string[]|null $role Filter users by role (optional) + * @param string|null $q The query to search (optional) + * @param string[]|null $group Filter users by group (optional) + * @param bool|null $no_active_license Filter users who don't have an active license (optional) + * @param string|null $test_accounts Filter users based on test account status. Test accounts are student accounts created for testing purposes by teachers. * `exclude`: Hide test accounts from results. * `only`: Show only test accounts. When omitted, all users are returned. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['countOrgaUsers'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function countOrgaUsersRequest( + ?array $role = null, + ?string $q = null, + ?array $group = null, + ?bool $no_active_license = null, + ?string $test_accounts = null, + string $contentType = self::contentTypes['countOrgaUsers'][0] + ): Request + { + + $resourcePath = '/organizations/users/count'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $role, + 'role', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $q, + 'q', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $group, + 'group', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $no_active_license, + 'noActiveLicense', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $test_accounts, + 'testAccounts', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createLtiConfiguration + * + * Create a new LTI configuration (1.1 or 1.3) + * + * @param \Flat\APIClient\Model\LtiConfigurationCreate1p1|\Flat\APIClient\Model\LtiConfigurationCreate1p3Dynamic|\Flat\APIClient\Model\LtiConfigurationCreate1p3Deployment|\Flat\APIClient\Model\LtiConfigurationCreate1p3Manual $lti_configuration_create lti_configuration_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLtiConfiguration'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\LtiConfiguration1p1|\Flat\APIClient\Model\LtiConfiguration1p3|\Flat\APIClient\Model\FlatErrorResponse + */ + public function createLtiConfiguration( + \Flat\APIClient\Model\LtiConfigurationCreate1p1|\Flat\APIClient\Model\LtiConfigurationCreate1p3Dynamic|\Flat\APIClient\Model\LtiConfigurationCreate1p3Deployment|\Flat\APIClient\Model\LtiConfigurationCreate1p3Manual $lti_configuration_create, + string $contentType = self::contentTypes['createLtiConfiguration'][0] + ): \Flat\APIClient\Model\LtiConfiguration1p1|\Flat\APIClient\Model\LtiConfiguration1p3|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->createLtiConfigurationWithHttpInfo($lti_configuration_create, $contentType); + return $response; + } + + /** + * Operation createLtiConfigurationWithHttpInfo + * + * Create a new LTI configuration (1.1 or 1.3) + * + * @param \Flat\APIClient\Model\LtiConfigurationCreate1p1|\Flat\APIClient\Model\LtiConfigurationCreate1p3Dynamic|\Flat\APIClient\Model\LtiConfigurationCreate1p3Deployment|\Flat\APIClient\Model\LtiConfigurationCreate1p3Manual $lti_configuration_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLtiConfiguration'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\LtiConfiguration1p1|\Flat\APIClient\Model\LtiConfiguration1p3|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createLtiConfigurationWithHttpInfo( + \Flat\APIClient\Model\LtiConfigurationCreate1p1|\Flat\APIClient\Model\LtiConfigurationCreate1p3Dynamic|\Flat\APIClient\Model\LtiConfigurationCreate1p3Deployment|\Flat\APIClient\Model\LtiConfigurationCreate1p3Manual $lti_configuration_create, + string $contentType = self::contentTypes['createLtiConfiguration'][0] + ): array + { + $request = $this->createLtiConfigurationRequest($lti_configuration_create, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\LtiConfiguration', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\LtiConfiguration', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\LtiConfiguration', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createLtiConfigurationAsync + * + * Create a new LTI configuration (1.1 or 1.3) + * + * @param \Flat\APIClient\Model\LtiConfigurationCreate1p1|\Flat\APIClient\Model\LtiConfigurationCreate1p3Dynamic|\Flat\APIClient\Model\LtiConfigurationCreate1p3Deployment|\Flat\APIClient\Model\LtiConfigurationCreate1p3Manual $lti_configuration_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLtiConfiguration'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createLtiConfigurationAsync( + \Flat\APIClient\Model\LtiConfigurationCreate1p1|\Flat\APIClient\Model\LtiConfigurationCreate1p3Dynamic|\Flat\APIClient\Model\LtiConfigurationCreate1p3Deployment|\Flat\APIClient\Model\LtiConfigurationCreate1p3Manual $lti_configuration_create, + string $contentType = self::contentTypes['createLtiConfiguration'][0] + ): PromiseInterface + { + return $this->createLtiConfigurationAsyncWithHttpInfo($lti_configuration_create, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createLtiConfigurationAsyncWithHttpInfo + * + * Create a new LTI configuration (1.1 or 1.3) + * + * @param \Flat\APIClient\Model\LtiConfigurationCreate1p1|\Flat\APIClient\Model\LtiConfigurationCreate1p3Dynamic|\Flat\APIClient\Model\LtiConfigurationCreate1p3Deployment|\Flat\APIClient\Model\LtiConfigurationCreate1p3Manual $lti_configuration_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLtiConfiguration'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createLtiConfigurationAsyncWithHttpInfo( + \Flat\APIClient\Model\LtiConfigurationCreate1p1|\Flat\APIClient\Model\LtiConfigurationCreate1p3Dynamic|\Flat\APIClient\Model\LtiConfigurationCreate1p3Deployment|\Flat\APIClient\Model\LtiConfigurationCreate1p3Manual $lti_configuration_create, + string $contentType = self::contentTypes['createLtiConfiguration'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\LtiConfiguration'; + $request = $this->createLtiConfigurationRequest($lti_configuration_create, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createLtiConfiguration' + * + * @param \Flat\APIClient\Model\LtiConfigurationCreate1p1|\Flat\APIClient\Model\LtiConfigurationCreate1p3Dynamic|\Flat\APIClient\Model\LtiConfigurationCreate1p3Deployment|\Flat\APIClient\Model\LtiConfigurationCreate1p3Manual $lti_configuration_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLtiConfiguration'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createLtiConfigurationRequest( + \Flat\APIClient\Model\LtiConfigurationCreate1p1|\Flat\APIClient\Model\LtiConfigurationCreate1p3Dynamic|\Flat\APIClient\Model\LtiConfigurationCreate1p3Deployment|\Flat\APIClient\Model\LtiConfigurationCreate1p3Manual $lti_configuration_create, + string $contentType = self::contentTypes['createLtiConfiguration'][0] + ): Request + { + // verify the required parameter 'lti_configuration_create' is set + if ($lti_configuration_create === null || (is_array($lti_configuration_create) && count($lti_configuration_create) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $lti_configuration_create when calling createLtiConfiguration' + ); + } + + $resourcePath = '/organizations/lti/configurations'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($lti_configuration_create)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($lti_configuration_create)); + } else { + $httpBody = $lti_configuration_create; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createLtiCredentials + * + * Create a new couple of LTI 1.x credentials + * + * @param \Flat\APIClient\Model\LtiCredentialsCreation $body body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLtiCredentials'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\LtiCredentials|\Flat\APIClient\Model\FlatErrorResponse + * @deprecated + */ + public function createLtiCredentials( + \Flat\APIClient\Model\LtiCredentialsCreation $body, + string $contentType = self::contentTypes['createLtiCredentials'][0] + ): \Flat\APIClient\Model\LtiCredentials|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->createLtiCredentialsWithHttpInfo($body, $contentType); + return $response; + } + + /** + * Operation createLtiCredentialsWithHttpInfo + * + * Create a new couple of LTI 1.x credentials + * + * @param \Flat\APIClient\Model\LtiCredentialsCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLtiCredentials'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\LtiCredentials|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + * @deprecated + */ + public function createLtiCredentialsWithHttpInfo( + \Flat\APIClient\Model\LtiCredentialsCreation $body, + string $contentType = self::contentTypes['createLtiCredentials'][0] + ): array + { + $request = $this->createLtiCredentialsRequest($body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\LtiCredentials', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\LtiCredentials', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\LtiCredentials', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createLtiCredentialsAsync + * + * Create a new couple of LTI 1.x credentials + * + * @param \Flat\APIClient\Model\LtiCredentialsCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLtiCredentials'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + * @deprecated + */ + public function createLtiCredentialsAsync( + \Flat\APIClient\Model\LtiCredentialsCreation $body, + string $contentType = self::contentTypes['createLtiCredentials'][0] + ): PromiseInterface + { + return $this->createLtiCredentialsAsyncWithHttpInfo($body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createLtiCredentialsAsyncWithHttpInfo + * + * Create a new couple of LTI 1.x credentials + * + * @param \Flat\APIClient\Model\LtiCredentialsCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLtiCredentials'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + * @deprecated + */ + public function createLtiCredentialsAsyncWithHttpInfo( + \Flat\APIClient\Model\LtiCredentialsCreation $body, + string $contentType = self::contentTypes['createLtiCredentials'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\LtiCredentials'; + $request = $this->createLtiCredentialsRequest($body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createLtiCredentials' + * + * @param \Flat\APIClient\Model\LtiCredentialsCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLtiCredentials'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + * @deprecated + */ + public function createLtiCredentialsRequest( + \Flat\APIClient\Model\LtiCredentialsCreation $body, + string $contentType = self::contentTypes['createLtiCredentials'][0] + ): Request + { + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling createLtiCredentials' + ); + } + + $resourcePath = '/organizations/lti/credentials'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createOrganizationInvitation + * + * Create a new invitation to join the organization + * + * @param \Flat\APIClient\Model\OrganizationInvitationCreation $body body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrganizationInvitation'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\OrganizationInvitation|\Flat\APIClient\Model\FlatErrorResponse + */ + public function createOrganizationInvitation( + \Flat\APIClient\Model\OrganizationInvitationCreation $body, + string $contentType = self::contentTypes['createOrganizationInvitation'][0] + ): \Flat\APIClient\Model\OrganizationInvitation|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->createOrganizationInvitationWithHttpInfo($body, $contentType); + return $response; + } + + /** + * Operation createOrganizationInvitationWithHttpInfo + * + * Create a new invitation to join the organization + * + * @param \Flat\APIClient\Model\OrganizationInvitationCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrganizationInvitation'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\OrganizationInvitation|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createOrganizationInvitationWithHttpInfo( + \Flat\APIClient\Model\OrganizationInvitationCreation $body, + string $contentType = self::contentTypes['createOrganizationInvitation'][0] + ): array + { + $request = $this->createOrganizationInvitationRequest($body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\OrganizationInvitation', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\OrganizationInvitation', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\OrganizationInvitation', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createOrganizationInvitationAsync + * + * Create a new invitation to join the organization + * + * @param \Flat\APIClient\Model\OrganizationInvitationCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrganizationInvitation'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createOrganizationInvitationAsync( + \Flat\APIClient\Model\OrganizationInvitationCreation $body, + string $contentType = self::contentTypes['createOrganizationInvitation'][0] + ): PromiseInterface + { + return $this->createOrganizationInvitationAsyncWithHttpInfo($body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createOrganizationInvitationAsyncWithHttpInfo + * + * Create a new invitation to join the organization + * + * @param \Flat\APIClient\Model\OrganizationInvitationCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrganizationInvitation'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createOrganizationInvitationAsyncWithHttpInfo( + \Flat\APIClient\Model\OrganizationInvitationCreation $body, + string $contentType = self::contentTypes['createOrganizationInvitation'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\OrganizationInvitation'; + $request = $this->createOrganizationInvitationRequest($body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createOrganizationInvitation' + * + * @param \Flat\APIClient\Model\OrganizationInvitationCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrganizationInvitation'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createOrganizationInvitationRequest( + \Flat\APIClient\Model\OrganizationInvitationCreation $body, + string $contentType = self::contentTypes['createOrganizationInvitation'][0] + ): Request + { + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling createOrganizationInvitation' + ); + } + + $resourcePath = '/organizations/invitations'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createOrganizationUser + * + * Create a new user account + * + * @param \Flat\APIClient\Model\UserCreation $body body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrganizationUser'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\UserDetailsAdmin|\Flat\APIClient\Model\FlatErrorResponse + */ + public function createOrganizationUser( + \Flat\APIClient\Model\UserCreation $body, + string $contentType = self::contentTypes['createOrganizationUser'][0] + ): \Flat\APIClient\Model\UserDetailsAdmin|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->createOrganizationUserWithHttpInfo($body, $contentType); + return $response; + } + + /** + * Operation createOrganizationUserWithHttpInfo + * + * Create a new user account + * + * @param \Flat\APIClient\Model\UserCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrganizationUser'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\UserDetailsAdmin|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createOrganizationUserWithHttpInfo( + \Flat\APIClient\Model\UserCreation $body, + string $contentType = self::contentTypes['createOrganizationUser'][0] + ): array + { + $request = $this->createOrganizationUserRequest($body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\UserDetailsAdmin', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\UserDetailsAdmin', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\UserDetailsAdmin', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createOrganizationUserAsync + * + * Create a new user account + * + * @param \Flat\APIClient\Model\UserCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrganizationUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createOrganizationUserAsync( + \Flat\APIClient\Model\UserCreation $body, + string $contentType = self::contentTypes['createOrganizationUser'][0] + ): PromiseInterface + { + return $this->createOrganizationUserAsyncWithHttpInfo($body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createOrganizationUserAsyncWithHttpInfo + * + * Create a new user account + * + * @param \Flat\APIClient\Model\UserCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrganizationUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createOrganizationUserAsyncWithHttpInfo( + \Flat\APIClient\Model\UserCreation $body, + string $contentType = self::contentTypes['createOrganizationUser'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\UserDetailsAdmin'; + $request = $this->createOrganizationUserRequest($body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createOrganizationUser' + * + * @param \Flat\APIClient\Model\UserCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrganizationUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createOrganizationUserRequest( + \Flat\APIClient\Model\UserCreation $body, + string $contentType = self::contentTypes['createOrganizationUser'][0] + ): Request + { + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling createOrganizationUser' + ); + } + + $resourcePath = '/organizations/users'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createOrganizationUserAccessToken + * + * Create a delegated API access token for an organization user + * + * @param string $user Unique identifier of the Flat account (required) + * @param \Flat\APIClient\Model\OrganizationUserAccessTokenCreation $organization_user_access_token_creation organization_user_access_token_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrganizationUserAccessToken'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ApiAccessToken|\Flat\APIClient\Model\FlatErrorResponse + */ + public function createOrganizationUserAccessToken( + string $user, + \Flat\APIClient\Model\OrganizationUserAccessTokenCreation $organization_user_access_token_creation, + string $contentType = self::contentTypes['createOrganizationUserAccessToken'][0] + ): \Flat\APIClient\Model\ApiAccessToken|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->createOrganizationUserAccessTokenWithHttpInfo($user, $organization_user_access_token_creation, $contentType); + return $response; + } + + /** + * Operation createOrganizationUserAccessTokenWithHttpInfo + * + * Create a delegated API access token for an organization user + * + * @param string $user Unique identifier of the Flat account (required) + * @param \Flat\APIClient\Model\OrganizationUserAccessTokenCreation $organization_user_access_token_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrganizationUserAccessToken'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ApiAccessToken|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createOrganizationUserAccessTokenWithHttpInfo( + string $user, + \Flat\APIClient\Model\OrganizationUserAccessTokenCreation $organization_user_access_token_creation, + string $contentType = self::contentTypes['createOrganizationUserAccessToken'][0] + ): array + { + $request = $this->createOrganizationUserAccessTokenRequest($user, $organization_user_access_token_creation, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ApiAccessToken', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ApiAccessToken', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ApiAccessToken', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createOrganizationUserAccessTokenAsync + * + * Create a delegated API access token for an organization user + * + * @param string $user Unique identifier of the Flat account (required) + * @param \Flat\APIClient\Model\OrganizationUserAccessTokenCreation $organization_user_access_token_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrganizationUserAccessToken'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createOrganizationUserAccessTokenAsync( + string $user, + \Flat\APIClient\Model\OrganizationUserAccessTokenCreation $organization_user_access_token_creation, + string $contentType = self::contentTypes['createOrganizationUserAccessToken'][0] + ): PromiseInterface + { + return $this->createOrganizationUserAccessTokenAsyncWithHttpInfo($user, $organization_user_access_token_creation, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createOrganizationUserAccessTokenAsyncWithHttpInfo + * + * Create a delegated API access token for an organization user + * + * @param string $user Unique identifier of the Flat account (required) + * @param \Flat\APIClient\Model\OrganizationUserAccessTokenCreation $organization_user_access_token_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrganizationUserAccessToken'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createOrganizationUserAccessTokenAsyncWithHttpInfo( + string $user, + \Flat\APIClient\Model\OrganizationUserAccessTokenCreation $organization_user_access_token_creation, + string $contentType = self::contentTypes['createOrganizationUserAccessToken'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ApiAccessToken'; + $request = $this->createOrganizationUserAccessTokenRequest($user, $organization_user_access_token_creation, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createOrganizationUserAccessToken' + * + * @param string $user Unique identifier of the Flat account (required) + * @param \Flat\APIClient\Model\OrganizationUserAccessTokenCreation $organization_user_access_token_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrganizationUserAccessToken'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createOrganizationUserAccessTokenRequest( + string $user, + \Flat\APIClient\Model\OrganizationUserAccessTokenCreation $organization_user_access_token_creation, + string $contentType = self::contentTypes['createOrganizationUserAccessToken'][0] + ): Request + { + // verify the required parameter 'user' is set + if ($user === null || (is_array($user) && count($user) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $user when calling createOrganizationUserAccessToken' + ); + } + // verify the required parameter 'organization_user_access_token_creation' is set + if ($organization_user_access_token_creation === null || (is_array($organization_user_access_token_creation) && count($organization_user_access_token_creation) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $organization_user_access_token_creation when calling createOrganizationUserAccessToken' + ); + } + + $resourcePath = '/organizations/users/{user}/accessToken'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($user !== null) { + $resourcePath = str_replace( + '{user}', + ObjectSerializer::toPathValue($user), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($organization_user_access_token_creation)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($organization_user_access_token_creation)); + } else { + $httpBody = $organization_user_access_token_creation; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createOrganizationUserSigninLink + * + * Create a sign in link for an organization user + * + * @param string $user Unique identifier of the Flat account (required) + * @param \Flat\APIClient\Model\UserSigninLinkCreation $user_signin_link_creation user_signin_link_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrganizationUserSigninLink'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\UserSigninLink|\Flat\APIClient\Model\FlatErrorResponse + */ + public function createOrganizationUserSigninLink( + string $user, + \Flat\APIClient\Model\UserSigninLinkCreation $user_signin_link_creation, + string $contentType = self::contentTypes['createOrganizationUserSigninLink'][0] + ): \Flat\APIClient\Model\UserSigninLink|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->createOrganizationUserSigninLinkWithHttpInfo($user, $user_signin_link_creation, $contentType); + return $response; + } + + /** + * Operation createOrganizationUserSigninLinkWithHttpInfo + * + * Create a sign in link for an organization user + * + * @param string $user Unique identifier of the Flat account (required) + * @param \Flat\APIClient\Model\UserSigninLinkCreation $user_signin_link_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrganizationUserSigninLink'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\UserSigninLink|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createOrganizationUserSigninLinkWithHttpInfo( + string $user, + \Flat\APIClient\Model\UserSigninLinkCreation $user_signin_link_creation, + string $contentType = self::contentTypes['createOrganizationUserSigninLink'][0] + ): array + { + $request = $this->createOrganizationUserSigninLinkRequest($user, $user_signin_link_creation, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\UserSigninLink', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\UserSigninLink', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\UserSigninLink', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createOrganizationUserSigninLinkAsync + * + * Create a sign in link for an organization user + * + * @param string $user Unique identifier of the Flat account (required) + * @param \Flat\APIClient\Model\UserSigninLinkCreation $user_signin_link_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrganizationUserSigninLink'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createOrganizationUserSigninLinkAsync( + string $user, + \Flat\APIClient\Model\UserSigninLinkCreation $user_signin_link_creation, + string $contentType = self::contentTypes['createOrganizationUserSigninLink'][0] + ): PromiseInterface + { + return $this->createOrganizationUserSigninLinkAsyncWithHttpInfo($user, $user_signin_link_creation, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createOrganizationUserSigninLinkAsyncWithHttpInfo + * + * Create a sign in link for an organization user + * + * @param string $user Unique identifier of the Flat account (required) + * @param \Flat\APIClient\Model\UserSigninLinkCreation $user_signin_link_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrganizationUserSigninLink'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createOrganizationUserSigninLinkAsyncWithHttpInfo( + string $user, + \Flat\APIClient\Model\UserSigninLinkCreation $user_signin_link_creation, + string $contentType = self::contentTypes['createOrganizationUserSigninLink'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\UserSigninLink'; + $request = $this->createOrganizationUserSigninLinkRequest($user, $user_signin_link_creation, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createOrganizationUserSigninLink' + * + * @param string $user Unique identifier of the Flat account (required) + * @param \Flat\APIClient\Model\UserSigninLinkCreation $user_signin_link_creation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrganizationUserSigninLink'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createOrganizationUserSigninLinkRequest( + string $user, + \Flat\APIClient\Model\UserSigninLinkCreation $user_signin_link_creation, + string $contentType = self::contentTypes['createOrganizationUserSigninLink'][0] + ): Request + { + // verify the required parameter 'user' is set + if ($user === null || (is_array($user) && count($user) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $user when calling createOrganizationUserSigninLink' + ); + } + // verify the required parameter 'user_signin_link_creation' is set + if ($user_signin_link_creation === null || (is_array($user_signin_link_creation) && count($user_signin_link_creation) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $user_signin_link_creation when calling createOrganizationUserSigninLink' + ); + } + + $resourcePath = '/organizations/users/{user}/signinLink'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($user !== null) { + $resourcePath = str_replace( + '{user}', + ObjectSerializer::toPathValue($user), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($user_signin_link_creation)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($user_signin_link_creation)); + } else { + $httpBody = $user_signin_link_creation; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteLtiConfiguration + * + * Delete an LTI configuration + * + * @param string $configuration Configuration unique identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteLtiConfiguration'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\FlatErrorResponse|null + */ + public function deleteLtiConfiguration( + string $configuration, + string $contentType = self::contentTypes['deleteLtiConfiguration'][0] + ): ?\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->deleteLtiConfigurationWithHttpInfo($configuration, $contentType); + return $response; + } + + /** + * Operation deleteLtiConfigurationWithHttpInfo + * + * Delete an LTI configuration + * + * @param string $configuration Configuration unique identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteLtiConfiguration'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function deleteLtiConfigurationWithHttpInfo( + string $configuration, + string $contentType = self::contentTypes['deleteLtiConfiguration'][0] + ): array + { + $request = $this->deleteLtiConfigurationRequest($configuration, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation deleteLtiConfigurationAsync + * + * Delete an LTI configuration + * + * @param string $configuration Configuration unique identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteLtiConfiguration'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteLtiConfigurationAsync( + string $configuration, + string $contentType = self::contentTypes['deleteLtiConfiguration'][0] + ): PromiseInterface + { + return $this->deleteLtiConfigurationAsyncWithHttpInfo($configuration, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteLtiConfigurationAsyncWithHttpInfo + * + * Delete an LTI configuration + * + * @param string $configuration Configuration unique identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteLtiConfiguration'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteLtiConfigurationAsyncWithHttpInfo( + string $configuration, + string $contentType = self::contentTypes['deleteLtiConfiguration'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deleteLtiConfigurationRequest($configuration, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteLtiConfiguration' + * + * @param string $configuration Configuration unique identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteLtiConfiguration'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteLtiConfigurationRequest( + string $configuration, + string $contentType = self::contentTypes['deleteLtiConfiguration'][0] + ): Request + { + // verify the required parameter 'configuration' is set + if ($configuration === null || (is_array($configuration) && count($configuration) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $configuration when calling deleteLtiConfiguration' + ); + } + + $resourcePath = '/organizations/lti/configurations/{configuration}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($configuration !== null) { + $resourcePath = str_replace( + '{configuration}', + ObjectSerializer::toPathValue($configuration), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listLtiConfigurations + * + * List LTI configurations (1.1 and 1.3) + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLtiConfigurations'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return (\Flat\APIClient\Model\LtiConfiguration1p1|\Flat\APIClient\Model\LtiConfiguration1p3)[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function listLtiConfigurations( + string $contentType = self::contentTypes['listLtiConfigurations'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->listLtiConfigurationsWithHttpInfo($contentType); + return $response; + } + + /** + * Operation listLtiConfigurationsWithHttpInfo + * + * List LTI configurations (1.1 and 1.3) + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLtiConfigurations'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: (\Flat\APIClient\Model\LtiConfiguration1p1|\Flat\APIClient\Model\LtiConfiguration1p3)[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listLtiConfigurationsWithHttpInfo( + string $contentType = self::contentTypes['listLtiConfigurations'][0] + ): array + { + $request = $this->listLtiConfigurationsRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\LtiConfiguration[]', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\LtiConfiguration[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\LtiConfiguration[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listLtiConfigurationsAsync + * + * List LTI configurations (1.1 and 1.3) + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLtiConfigurations'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listLtiConfigurationsAsync( + string $contentType = self::contentTypes['listLtiConfigurations'][0] + ): PromiseInterface + { + return $this->listLtiConfigurationsAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listLtiConfigurationsAsyncWithHttpInfo + * + * List LTI configurations (1.1 and 1.3) + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLtiConfigurations'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listLtiConfigurationsAsyncWithHttpInfo( + string $contentType = self::contentTypes['listLtiConfigurations'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\LtiConfiguration[]'; + $request = $this->listLtiConfigurationsRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listLtiConfigurations' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLtiConfigurations'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listLtiConfigurationsRequest( + string $contentType = self::contentTypes['listLtiConfigurations'][0] + ): Request + { + + $resourcePath = '/organizations/lti/configurations'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listLtiCredentials + * + * List LTI 1.x credentials + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLtiCredentials'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\LtiCredentials[]|\Flat\APIClient\Model\FlatErrorResponse + * @deprecated + */ + public function listLtiCredentials( + string $contentType = self::contentTypes['listLtiCredentials'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->listLtiCredentialsWithHttpInfo($contentType); + return $response; + } + + /** + * Operation listLtiCredentialsWithHttpInfo + * + * List LTI 1.x credentials + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLtiCredentials'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\LtiCredentials[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + * @deprecated + */ + public function listLtiCredentialsWithHttpInfo( + string $contentType = self::contentTypes['listLtiCredentials'][0] + ): array + { + $request = $this->listLtiCredentialsRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\LtiCredentials[]', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\LtiCredentials[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\LtiCredentials[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listLtiCredentialsAsync + * + * List LTI 1.x credentials + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLtiCredentials'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + * @deprecated + */ + public function listLtiCredentialsAsync( + string $contentType = self::contentTypes['listLtiCredentials'][0] + ): PromiseInterface + { + return $this->listLtiCredentialsAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listLtiCredentialsAsyncWithHttpInfo + * + * List LTI 1.x credentials + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLtiCredentials'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + * @deprecated + */ + public function listLtiCredentialsAsyncWithHttpInfo( + string $contentType = self::contentTypes['listLtiCredentials'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\LtiCredentials[]'; + $request = $this->listLtiCredentialsRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listLtiCredentials' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLtiCredentials'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + * @deprecated + */ + public function listLtiCredentialsRequest( + string $contentType = self::contentTypes['listLtiCredentials'][0] + ): Request + { + + $resourcePath = '/organizations/lti/credentials'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listOrganizationInvitations + * + * List the organization invitations + * + * @param string|null $role Filter users by role (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 50) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOrganizationInvitations'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\OrganizationInvitation[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function listOrganizationInvitations( + ?string $role = null, + ?int $limit = 50, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['listOrganizationInvitations'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->listOrganizationInvitationsWithHttpInfo($role, $limit, $next, $previous, $contentType); + return $response; + } + + /** + * Operation listOrganizationInvitationsWithHttpInfo + * + * List the organization invitations + * + * @param string|null $role Filter users by role (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 50) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOrganizationInvitations'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\OrganizationInvitation[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listOrganizationInvitationsWithHttpInfo( + ?string $role = null, + ?int $limit = 50, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['listOrganizationInvitations'][0] + ): array + { + $request = $this->listOrganizationInvitationsRequest($role, $limit, $next, $previous, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\OrganizationInvitation[]', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\OrganizationInvitation[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\OrganizationInvitation[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listOrganizationInvitationsAsync + * + * List the organization invitations + * + * @param string|null $role Filter users by role (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 50) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOrganizationInvitations'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listOrganizationInvitationsAsync( + ?string $role = null, + ?int $limit = 50, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['listOrganizationInvitations'][0] + ): PromiseInterface + { + return $this->listOrganizationInvitationsAsyncWithHttpInfo($role, $limit, $next, $previous, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listOrganizationInvitationsAsyncWithHttpInfo + * + * List the organization invitations + * + * @param string|null $role Filter users by role (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 50) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOrganizationInvitations'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listOrganizationInvitationsAsyncWithHttpInfo( + ?string $role = null, + ?int $limit = 50, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['listOrganizationInvitations'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\OrganizationInvitation[]'; + $request = $this->listOrganizationInvitationsRequest($role, $limit, $next, $previous, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listOrganizationInvitations' + * + * @param string|null $role Filter users by role (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 50) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOrganizationInvitations'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listOrganizationInvitationsRequest( + ?string $role = null, + ?int $limit = 50, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['listOrganizationInvitations'][0] + ): Request + { + if ($limit !== null && $limit > 1000) { + throw new InvalidArgumentException('invalid value for "$limit" when calling OrganizationApi.listOrganizationInvitations, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new InvalidArgumentException('invalid value for "$limit" when calling OrganizationApi.listOrganizationInvitations, must be bigger than or equal to 1.'); + } + + $resourcePath = '/organizations/invitations'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $role, + 'role', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $next, + 'next', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $previous, + 'previous', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listOrganizationUsers + * + * List the organization users + * + * @param string|null $sort The order to sort the user list. * `creationDate`: Order by account creation. * `firstname`, `lastname`, `username`: Order by the user identity. * `lastActivityDate`: Order by the last recorded activity. * `licenseExpirationDate`: Order by the expiration of the active license. (optional) + * @param string|null $direction Sort direction (optional) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string[]|null $role Filter users by role (optional) + * @param string|null $q The query to search (optional) + * @param string[]|null $group Filter users by group (optional) + * @param bool|null $no_active_license Filter users who don't have an active license (optional) + * @param string|null $test_accounts Filter users based on test account status. Test accounts are student accounts created for testing purposes by teachers. * `exclude`: Hide test accounts from results. * `only`: Show only test accounts. When omitted, all users are returned. (optional) + * @param string[]|null $license_expiration_date Filter users by license expiration date or `active` / `notActive` (optional) + * @param bool|null $only_ids Return only user ids (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOrganizationUsers'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\UserDetailsAdmin[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function listOrganizationUsers( + ?string $sort = null, + ?string $direction = null, + ?string $next = null, + ?string $previous = null, + ?array $role = null, + ?string $q = null, + ?array $group = null, + ?bool $no_active_license = null, + ?string $test_accounts = null, + ?array $license_expiration_date = null, + ?bool $only_ids = null, + ?int $limit = 25, + string $contentType = self::contentTypes['listOrganizationUsers'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->listOrganizationUsersWithHttpInfo($sort, $direction, $next, $previous, $role, $q, $group, $no_active_license, $test_accounts, $license_expiration_date, $only_ids, $limit, $contentType); + return $response; + } + + /** + * Operation listOrganizationUsersWithHttpInfo + * + * List the organization users + * + * @param string|null $sort The order to sort the user list. * `creationDate`: Order by account creation. * `firstname`, `lastname`, `username`: Order by the user identity. * `lastActivityDate`: Order by the last recorded activity. * `licenseExpirationDate`: Order by the expiration of the active license. (optional) + * @param string|null $direction Sort direction (optional) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string[]|null $role Filter users by role (optional) + * @param string|null $q The query to search (optional) + * @param string[]|null $group Filter users by group (optional) + * @param bool|null $no_active_license Filter users who don't have an active license (optional) + * @param string|null $test_accounts Filter users based on test account status. Test accounts are student accounts created for testing purposes by teachers. * `exclude`: Hide test accounts from results. * `only`: Show only test accounts. When omitted, all users are returned. (optional) + * @param string[]|null $license_expiration_date Filter users by license expiration date or `active` / `notActive` (optional) + * @param bool|null $only_ids Return only user ids (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOrganizationUsers'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\UserDetailsAdmin[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listOrganizationUsersWithHttpInfo( + ?string $sort = null, + ?string $direction = null, + ?string $next = null, + ?string $previous = null, + ?array $role = null, + ?string $q = null, + ?array $group = null, + ?bool $no_active_license = null, + ?string $test_accounts = null, + ?array $license_expiration_date = null, + ?bool $only_ids = null, + ?int $limit = 25, + string $contentType = self::contentTypes['listOrganizationUsers'][0] + ): array + { + $request = $this->listOrganizationUsersRequest($sort, $direction, $next, $previous, $role, $q, $group, $no_active_license, $test_accounts, $license_expiration_date, $only_ids, $limit, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\UserDetailsAdmin[]', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\UserDetailsAdmin[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\UserDetailsAdmin[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listOrganizationUsersAsync + * + * List the organization users + * + * @param string|null $sort The order to sort the user list. * `creationDate`: Order by account creation. * `firstname`, `lastname`, `username`: Order by the user identity. * `lastActivityDate`: Order by the last recorded activity. * `licenseExpirationDate`: Order by the expiration of the active license. (optional) + * @param string|null $direction Sort direction (optional) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string[]|null $role Filter users by role (optional) + * @param string|null $q The query to search (optional) + * @param string[]|null $group Filter users by group (optional) + * @param bool|null $no_active_license Filter users who don't have an active license (optional) + * @param string|null $test_accounts Filter users based on test account status. Test accounts are student accounts created for testing purposes by teachers. * `exclude`: Hide test accounts from results. * `only`: Show only test accounts. When omitted, all users are returned. (optional) + * @param string[]|null $license_expiration_date Filter users by license expiration date or `active` / `notActive` (optional) + * @param bool|null $only_ids Return only user ids (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOrganizationUsers'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listOrganizationUsersAsync( + ?string $sort = null, + ?string $direction = null, + ?string $next = null, + ?string $previous = null, + ?array $role = null, + ?string $q = null, + ?array $group = null, + ?bool $no_active_license = null, + ?string $test_accounts = null, + ?array $license_expiration_date = null, + ?bool $only_ids = null, + ?int $limit = 25, + string $contentType = self::contentTypes['listOrganizationUsers'][0] + ): PromiseInterface + { + return $this->listOrganizationUsersAsyncWithHttpInfo($sort, $direction, $next, $previous, $role, $q, $group, $no_active_license, $test_accounts, $license_expiration_date, $only_ids, $limit, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listOrganizationUsersAsyncWithHttpInfo + * + * List the organization users + * + * @param string|null $sort The order to sort the user list. * `creationDate`: Order by account creation. * `firstname`, `lastname`, `username`: Order by the user identity. * `lastActivityDate`: Order by the last recorded activity. * `licenseExpirationDate`: Order by the expiration of the active license. (optional) + * @param string|null $direction Sort direction (optional) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string[]|null $role Filter users by role (optional) + * @param string|null $q The query to search (optional) + * @param string[]|null $group Filter users by group (optional) + * @param bool|null $no_active_license Filter users who don't have an active license (optional) + * @param string|null $test_accounts Filter users based on test account status. Test accounts are student accounts created for testing purposes by teachers. * `exclude`: Hide test accounts from results. * `only`: Show only test accounts. When omitted, all users are returned. (optional) + * @param string[]|null $license_expiration_date Filter users by license expiration date or `active` / `notActive` (optional) + * @param bool|null $only_ids Return only user ids (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOrganizationUsers'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listOrganizationUsersAsyncWithHttpInfo( + ?string $sort = null, + ?string $direction = null, + ?string $next = null, + ?string $previous = null, + ?array $role = null, + ?string $q = null, + ?array $group = null, + ?bool $no_active_license = null, + ?string $test_accounts = null, + ?array $license_expiration_date = null, + ?bool $only_ids = null, + ?int $limit = 25, + string $contentType = self::contentTypes['listOrganizationUsers'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\UserDetailsAdmin[]'; + $request = $this->listOrganizationUsersRequest($sort, $direction, $next, $previous, $role, $q, $group, $no_active_license, $test_accounts, $license_expiration_date, $only_ids, $limit, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listOrganizationUsers' + * + * @param string|null $sort The order to sort the user list. * `creationDate`: Order by account creation. * `firstname`, `lastname`, `username`: Order by the user identity. * `lastActivityDate`: Order by the last recorded activity. * `licenseExpirationDate`: Order by the expiration of the active license. (optional) + * @param string|null $direction Sort direction (optional) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string[]|null $role Filter users by role (optional) + * @param string|null $q The query to search (optional) + * @param string[]|null $group Filter users by group (optional) + * @param bool|null $no_active_license Filter users who don't have an active license (optional) + * @param string|null $test_accounts Filter users based on test account status. Test accounts are student accounts created for testing purposes by teachers. * `exclude`: Hide test accounts from results. * `only`: Show only test accounts. When omitted, all users are returned. (optional) + * @param string[]|null $license_expiration_date Filter users by license expiration date or `active` / `notActive` (optional) + * @param bool|null $only_ids Return only user ids (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOrganizationUsers'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listOrganizationUsersRequest( + ?string $sort = null, + ?string $direction = null, + ?string $next = null, + ?string $previous = null, + ?array $role = null, + ?string $q = null, + ?array $group = null, + ?bool $no_active_license = null, + ?string $test_accounts = null, + ?array $license_expiration_date = null, + ?bool $only_ids = null, + ?int $limit = 25, + string $contentType = self::contentTypes['listOrganizationUsers'][0] + ): Request + { + if ($limit !== null && $limit > 1000) { + throw new InvalidArgumentException('invalid value for "$limit" when calling OrganizationApi.listOrganizationUsers, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new InvalidArgumentException('invalid value for "$limit" when calling OrganizationApi.listOrganizationUsers, must be bigger than or equal to 1.'); + } + + $resourcePath = '/organizations/users'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $direction, + 'direction', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $next, + 'next', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $previous, + 'previous', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $role, + 'role', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $q, + 'q', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $group, + 'group', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $no_active_license, + 'noActiveLicense', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $test_accounts, + 'testAccounts', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $license_expiration_date, + 'licenseExpirationDate', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $only_ids, + 'onlyIds', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation removeOrganizationInvitation + * + * Remove an organization invitation + * + * @param string $invitation Unique identifier of the invitation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeOrganizationInvitation'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\FlatErrorResponse|null + */ + public function removeOrganizationInvitation( + string $invitation, + string $contentType = self::contentTypes['removeOrganizationInvitation'][0] + ): ?\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->removeOrganizationInvitationWithHttpInfo($invitation, $contentType); + return $response; + } + + /** + * Operation removeOrganizationInvitationWithHttpInfo + * + * Remove an organization invitation + * + * @param string $invitation Unique identifier of the invitation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeOrganizationInvitation'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function removeOrganizationInvitationWithHttpInfo( + string $invitation, + string $contentType = self::contentTypes['removeOrganizationInvitation'][0] + ): array + { + $request = $this->removeOrganizationInvitationRequest($invitation, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation removeOrganizationInvitationAsync + * + * Remove an organization invitation + * + * @param string $invitation Unique identifier of the invitation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeOrganizationInvitation'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function removeOrganizationInvitationAsync( + string $invitation, + string $contentType = self::contentTypes['removeOrganizationInvitation'][0] + ): PromiseInterface + { + return $this->removeOrganizationInvitationAsyncWithHttpInfo($invitation, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation removeOrganizationInvitationAsyncWithHttpInfo + * + * Remove an organization invitation + * + * @param string $invitation Unique identifier of the invitation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeOrganizationInvitation'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function removeOrganizationInvitationAsyncWithHttpInfo( + string $invitation, + string $contentType = self::contentTypes['removeOrganizationInvitation'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->removeOrganizationInvitationRequest($invitation, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'removeOrganizationInvitation' + * + * @param string $invitation Unique identifier of the invitation (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeOrganizationInvitation'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function removeOrganizationInvitationRequest( + string $invitation, + string $contentType = self::contentTypes['removeOrganizationInvitation'][0] + ): Request + { + // verify the required parameter 'invitation' is set + if ($invitation === null || (is_array($invitation) && count($invitation) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $invitation when calling removeOrganizationInvitation' + ); + } + + $resourcePath = '/organizations/invitations/{invitation}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($invitation !== null) { + $resourcePath = str_replace( + '{invitation}', + ObjectSerializer::toPathValue($invitation), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation removeOrganizationUser + * + * Remove an account from Flat + * + * @param string $user Unique identifier of the Flat account (required) + * @param bool|null $convert_to_individual If `true`, the account will be only removed from the organization and converted into an individual account on our public website, https://flat.io. This operation will remove the education-related data from the account. Before realizing this operation, you need to be sure that the user is at least 13 years old and that this one has read and agreed to the Individual Terms of Services of Flat available on https://flat.io/legal. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeOrganizationUser'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\FlatErrorResponse|null + */ + public function removeOrganizationUser( + string $user, + ?bool $convert_to_individual = null, + string $contentType = self::contentTypes['removeOrganizationUser'][0] + ): ?\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->removeOrganizationUserWithHttpInfo($user, $convert_to_individual, $contentType); + return $response; + } + + /** + * Operation removeOrganizationUserWithHttpInfo + * + * Remove an account from Flat + * + * @param string $user Unique identifier of the Flat account (required) + * @param bool|null $convert_to_individual If `true`, the account will be only removed from the organization and converted into an individual account on our public website, https://flat.io. This operation will remove the education-related data from the account. Before realizing this operation, you need to be sure that the user is at least 13 years old and that this one has read and agreed to the Individual Terms of Services of Flat available on https://flat.io/legal. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeOrganizationUser'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function removeOrganizationUserWithHttpInfo( + string $user, + ?bool $convert_to_individual = null, + string $contentType = self::contentTypes['removeOrganizationUser'][0] + ): array + { + $request = $this->removeOrganizationUserRequest($user, $convert_to_individual, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation removeOrganizationUserAsync + * + * Remove an account from Flat + * + * @param string $user Unique identifier of the Flat account (required) + * @param bool|null $convert_to_individual If `true`, the account will be only removed from the organization and converted into an individual account on our public website, https://flat.io. This operation will remove the education-related data from the account. Before realizing this operation, you need to be sure that the user is at least 13 years old and that this one has read and agreed to the Individual Terms of Services of Flat available on https://flat.io/legal. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeOrganizationUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function removeOrganizationUserAsync( + string $user, + ?bool $convert_to_individual = null, + string $contentType = self::contentTypes['removeOrganizationUser'][0] + ): PromiseInterface + { + return $this->removeOrganizationUserAsyncWithHttpInfo($user, $convert_to_individual, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation removeOrganizationUserAsyncWithHttpInfo + * + * Remove an account from Flat + * + * @param string $user Unique identifier of the Flat account (required) + * @param bool|null $convert_to_individual If `true`, the account will be only removed from the organization and converted into an individual account on our public website, https://flat.io. This operation will remove the education-related data from the account. Before realizing this operation, you need to be sure that the user is at least 13 years old and that this one has read and agreed to the Individual Terms of Services of Flat available on https://flat.io/legal. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeOrganizationUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function removeOrganizationUserAsyncWithHttpInfo( + string $user, + ?bool $convert_to_individual = null, + string $contentType = self::contentTypes['removeOrganizationUser'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->removeOrganizationUserRequest($user, $convert_to_individual, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'removeOrganizationUser' + * + * @param string $user Unique identifier of the Flat account (required) + * @param bool|null $convert_to_individual If `true`, the account will be only removed from the organization and converted into an individual account on our public website, https://flat.io. This operation will remove the education-related data from the account. Before realizing this operation, you need to be sure that the user is at least 13 years old and that this one has read and agreed to the Individual Terms of Services of Flat available on https://flat.io/legal. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeOrganizationUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function removeOrganizationUserRequest( + string $user, + ?bool $convert_to_individual = null, + string $contentType = self::contentTypes['removeOrganizationUser'][0] + ): Request + { + // verify the required parameter 'user' is set + if ($user === null || (is_array($user) && count($user) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $user when calling removeOrganizationUser' + ); + } + + $resourcePath = '/organizations/users/{user}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $convert_to_individual, + 'convertToIndividual', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($user !== null) { + $resourcePath = str_replace( + '{user}', + ObjectSerializer::toPathValue($user), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation revokeLtiCredentials + * + * Revoke LTI 1.x credentials + * + * @param string $credentials Credentials unique identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['revokeLtiCredentials'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\FlatErrorResponse|null + * @deprecated + */ + public function revokeLtiCredentials( + string $credentials, + string $contentType = self::contentTypes['revokeLtiCredentials'][0] + ): ?\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->revokeLtiCredentialsWithHttpInfo($credentials, $contentType); + return $response; + } + + /** + * Operation revokeLtiCredentialsWithHttpInfo + * + * Revoke LTI 1.x credentials + * + * @param string $credentials Credentials unique identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['revokeLtiCredentials'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + * @deprecated + */ + public function revokeLtiCredentialsWithHttpInfo( + string $credentials, + string $contentType = self::contentTypes['revokeLtiCredentials'][0] + ): array + { + $request = $this->revokeLtiCredentialsRequest($credentials, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation revokeLtiCredentialsAsync + * + * Revoke LTI 1.x credentials + * + * @param string $credentials Credentials unique identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['revokeLtiCredentials'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + * @deprecated + */ + public function revokeLtiCredentialsAsync( + string $credentials, + string $contentType = self::contentTypes['revokeLtiCredentials'][0] + ): PromiseInterface + { + return $this->revokeLtiCredentialsAsyncWithHttpInfo($credentials, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation revokeLtiCredentialsAsyncWithHttpInfo + * + * Revoke LTI 1.x credentials + * + * @param string $credentials Credentials unique identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['revokeLtiCredentials'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + * @deprecated + */ + public function revokeLtiCredentialsAsyncWithHttpInfo( + string $credentials, + string $contentType = self::contentTypes['revokeLtiCredentials'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->revokeLtiCredentialsRequest($credentials, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'revokeLtiCredentials' + * + * @param string $credentials Credentials unique identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['revokeLtiCredentials'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + * @deprecated + */ + public function revokeLtiCredentialsRequest( + string $credentials, + string $contentType = self::contentTypes['revokeLtiCredentials'][0] + ): Request + { + // verify the required parameter 'credentials' is set + if ($credentials === null || (is_array($credentials) && count($credentials) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $credentials when calling revokeLtiCredentials' + ); + } + + $resourcePath = '/organizations/lti/credentials/{credentials}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($credentials !== null) { + $resourcePath = str_replace( + '{credentials}', + ObjectSerializer::toPathValue($credentials), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateLtiConfiguration + * + * Update an existing LTI configuration (edit 1.3; 1.1 not editable) + * + * @param string $configuration Configuration unique identifier (required) + * @param \Flat\APIClient\Model\LtiConfigurationUpdate $lti_configuration_update lti_configuration_update (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLtiConfiguration'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\LtiConfiguration1p1|\Flat\APIClient\Model\LtiConfiguration1p3|\Flat\APIClient\Model\FlatErrorResponse + */ + public function updateLtiConfiguration( + string $configuration, + \Flat\APIClient\Model\LtiConfigurationUpdate $lti_configuration_update, + string $contentType = self::contentTypes['updateLtiConfiguration'][0] + ): \Flat\APIClient\Model\LtiConfiguration1p1|\Flat\APIClient\Model\LtiConfiguration1p3|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->updateLtiConfigurationWithHttpInfo($configuration, $lti_configuration_update, $contentType); + return $response; + } + + /** + * Operation updateLtiConfigurationWithHttpInfo + * + * Update an existing LTI configuration (edit 1.3; 1.1 not editable) + * + * @param string $configuration Configuration unique identifier (required) + * @param \Flat\APIClient\Model\LtiConfigurationUpdate $lti_configuration_update (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLtiConfiguration'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\LtiConfiguration1p1|\Flat\APIClient\Model\LtiConfiguration1p3|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function updateLtiConfigurationWithHttpInfo( + string $configuration, + \Flat\APIClient\Model\LtiConfigurationUpdate $lti_configuration_update, + string $contentType = self::contentTypes['updateLtiConfiguration'][0] + ): array + { + $request = $this->updateLtiConfigurationRequest($configuration, $lti_configuration_update, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\LtiConfiguration', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\LtiConfiguration', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\LtiConfiguration', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation updateLtiConfigurationAsync + * + * Update an existing LTI configuration (edit 1.3; 1.1 not editable) + * + * @param string $configuration Configuration unique identifier (required) + * @param \Flat\APIClient\Model\LtiConfigurationUpdate $lti_configuration_update (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLtiConfiguration'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateLtiConfigurationAsync( + string $configuration, + \Flat\APIClient\Model\LtiConfigurationUpdate $lti_configuration_update, + string $contentType = self::contentTypes['updateLtiConfiguration'][0] + ): PromiseInterface + { + return $this->updateLtiConfigurationAsyncWithHttpInfo($configuration, $lti_configuration_update, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateLtiConfigurationAsyncWithHttpInfo + * + * Update an existing LTI configuration (edit 1.3; 1.1 not editable) + * + * @param string $configuration Configuration unique identifier (required) + * @param \Flat\APIClient\Model\LtiConfigurationUpdate $lti_configuration_update (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLtiConfiguration'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateLtiConfigurationAsyncWithHttpInfo( + string $configuration, + \Flat\APIClient\Model\LtiConfigurationUpdate $lti_configuration_update, + string $contentType = self::contentTypes['updateLtiConfiguration'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\LtiConfiguration'; + $request = $this->updateLtiConfigurationRequest($configuration, $lti_configuration_update, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateLtiConfiguration' + * + * @param string $configuration Configuration unique identifier (required) + * @param \Flat\APIClient\Model\LtiConfigurationUpdate $lti_configuration_update (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLtiConfiguration'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateLtiConfigurationRequest( + string $configuration, + \Flat\APIClient\Model\LtiConfigurationUpdate $lti_configuration_update, + string $contentType = self::contentTypes['updateLtiConfiguration'][0] + ): Request + { + // verify the required parameter 'configuration' is set + if ($configuration === null || (is_array($configuration) && count($configuration) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $configuration when calling updateLtiConfiguration' + ); + } + // verify the required parameter 'lti_configuration_update' is set + if ($lti_configuration_update === null || (is_array($lti_configuration_update) && count($lti_configuration_update) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $lti_configuration_update when calling updateLtiConfiguration' + ); + } + + $resourcePath = '/organizations/lti/configurations/{configuration}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($configuration !== null) { + $resourcePath = str_replace( + '{configuration}', + ObjectSerializer::toPathValue($configuration), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($lti_configuration_update)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($lti_configuration_update)); + } else { + $httpBody = $lti_configuration_update; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateOrganizationUser + * + * Update account information + * + * @param string $user Unique identifier of the Flat account (required) + * @param \Flat\APIClient\Model\UserAdminUpdate $body body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateOrganizationUser'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\UserDetailsAdmin|\Flat\APIClient\Model\FlatErrorResponse + */ + public function updateOrganizationUser( + string $user, + \Flat\APIClient\Model\UserAdminUpdate $body, + string $contentType = self::contentTypes['updateOrganizationUser'][0] + ): \Flat\APIClient\Model\UserDetailsAdmin|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->updateOrganizationUserWithHttpInfo($user, $body, $contentType); + return $response; + } + + /** + * Operation updateOrganizationUserWithHttpInfo + * + * Update account information + * + * @param string $user Unique identifier of the Flat account (required) + * @param \Flat\APIClient\Model\UserAdminUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateOrganizationUser'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\UserDetailsAdmin|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function updateOrganizationUserWithHttpInfo( + string $user, + \Flat\APIClient\Model\UserAdminUpdate $body, + string $contentType = self::contentTypes['updateOrganizationUser'][0] + ): array + { + $request = $this->updateOrganizationUserRequest($user, $body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\UserDetailsAdmin', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\UserDetailsAdmin', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\UserDetailsAdmin', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation updateOrganizationUserAsync + * + * Update account information + * + * @param string $user Unique identifier of the Flat account (required) + * @param \Flat\APIClient\Model\UserAdminUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateOrganizationUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateOrganizationUserAsync( + string $user, + \Flat\APIClient\Model\UserAdminUpdate $body, + string $contentType = self::contentTypes['updateOrganizationUser'][0] + ): PromiseInterface + { + return $this->updateOrganizationUserAsyncWithHttpInfo($user, $body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateOrganizationUserAsyncWithHttpInfo + * + * Update account information + * + * @param string $user Unique identifier of the Flat account (required) + * @param \Flat\APIClient\Model\UserAdminUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateOrganizationUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateOrganizationUserAsyncWithHttpInfo( + string $user, + \Flat\APIClient\Model\UserAdminUpdate $body, + string $contentType = self::contentTypes['updateOrganizationUser'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\UserDetailsAdmin'; + $request = $this->updateOrganizationUserRequest($user, $body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateOrganizationUser' + * + * @param string $user Unique identifier of the Flat account (required) + * @param \Flat\APIClient\Model\UserAdminUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateOrganizationUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateOrganizationUserRequest( + string $user, + \Flat\APIClient\Model\UserAdminUpdate $body, + string $contentType = self::contentTypes['updateOrganizationUser'][0] + ): Request + { + // verify the required parameter 'user' is set + if ($user === null || (is_array($user) && count($user) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $user when calling updateOrganizationUser' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling updateOrganizationUser' + ); + } + + $resourcePath = '/organizations/users/{user}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($user !== null) { + $resourcePath = str_replace( + '{user}', + ObjectSerializer::toPathValue($user), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/src/Api/ScoreApi.php b/src/Api/ScoreApi.php new file mode 100644 index 0000000..fa82294 --- /dev/null +++ b/src/Api/ScoreApi.php @@ -0,0 +1,10399 @@ + $contentTypes **/ + public const contentTypes = [ + 'addScoreCollaborator' => [ + 'application/json', + ], + 'addScoreTrack' => [ + 'application/json', + ], + 'createExportTask' => [ + 'application/json', + ], + 'createScore' => [ + 'application/json', + ], + 'createScoreRevision' => [ + 'application/json', + ], + 'deleteScore' => [ + 'application/json', + ], + 'deleteScoreComment' => [ + 'application/x-www-form-urlencoded', + ], + 'deleteScoreTrack' => [ + 'application/json', + ], + 'editScore' => [ + 'application/json', + ], + 'forkScore' => [ + 'application/json', + ], + 'getGroupScores' => [ + 'application/json', + ], + 'getScore' => [ + 'application/json', + ], + 'getScoreCollaborator' => [ + 'application/json', + ], + 'getScoreCollaborators' => [ + 'application/json', + ], + 'getScoreComments' => [ + 'application/json', + ], + 'getScoreRevision' => [ + 'application/json', + ], + 'getScoreRevisionData' => [ + 'application/json', + ], + 'getScoreRevisions' => [ + 'application/json', + ], + 'getScoreSubmissions' => [ + 'application/json', + ], + 'getScoreTrack' => [ + 'application/json', + ], + 'getUserLikes' => [ + 'application/json', + ], + 'getUserScores' => [ + 'application/json', + ], + 'listScoreTracks' => [ + 'application/json', + ], + 'markScoreCommentResolved' => [ + 'application/json', + ], + 'markScoreCommentUnresolved' => [ + 'application/json', + ], + 'postScoreComment' => [ + 'application/json', + ], + 'removeScoreCollaborator' => [ + 'application/x-www-form-urlencoded', + ], + 'untrashScore' => [ + 'application/json', + ], + 'updateScoreComment' => [ + 'application/json', + ], + 'updateScoreTrack' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation addScoreCollaborator + * + * Add a new collaborator + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ResourceCollaboratorCreation $body body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addScoreCollaborator'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ResourceCollaborator|\Flat\APIClient\Model\FlatErrorResponse + */ + public function addScoreCollaborator( + string $score, + \Flat\APIClient\Model\ResourceCollaboratorCreation $body, + string $contentType = self::contentTypes['addScoreCollaborator'][0] + ): \Flat\APIClient\Model\ResourceCollaborator|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->addScoreCollaboratorWithHttpInfo($score, $body, $contentType); + return $response; + } + + /** + * Operation addScoreCollaboratorWithHttpInfo + * + * Add a new collaborator + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ResourceCollaboratorCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addScoreCollaborator'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ResourceCollaborator|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function addScoreCollaboratorWithHttpInfo( + string $score, + \Flat\APIClient\Model\ResourceCollaboratorCreation $body, + string $contentType = self::contentTypes['addScoreCollaborator'][0] + ): array + { + $request = $this->addScoreCollaboratorRequest($score, $body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ResourceCollaborator', + $request, + $response, + ); + case 402: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ResourceCollaborator', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ResourceCollaborator', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation addScoreCollaboratorAsync + * + * Add a new collaborator + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ResourceCollaboratorCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addScoreCollaborator'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function addScoreCollaboratorAsync( + string $score, + \Flat\APIClient\Model\ResourceCollaboratorCreation $body, + string $contentType = self::contentTypes['addScoreCollaborator'][0] + ): PromiseInterface + { + return $this->addScoreCollaboratorAsyncWithHttpInfo($score, $body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addScoreCollaboratorAsyncWithHttpInfo + * + * Add a new collaborator + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ResourceCollaboratorCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addScoreCollaborator'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function addScoreCollaboratorAsyncWithHttpInfo( + string $score, + \Flat\APIClient\Model\ResourceCollaboratorCreation $body, + string $contentType = self::contentTypes['addScoreCollaborator'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ResourceCollaborator'; + $request = $this->addScoreCollaboratorRequest($score, $body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'addScoreCollaborator' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ResourceCollaboratorCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addScoreCollaborator'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function addScoreCollaboratorRequest( + string $score, + \Flat\APIClient\Model\ResourceCollaboratorCreation $body, + string $contentType = self::contentTypes['addScoreCollaborator'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling addScoreCollaborator' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling addScoreCollaborator' + ); + } + + $resourcePath = '/scores/{score}/collaborators'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation addScoreTrack + * + * Add a new video or audio track to the score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreTrackCreation $body body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addScoreTrack'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ScoreTrackCreationResponse|\Flat\APIClient\Model\FlatErrorResponse + */ + public function addScoreTrack( + string $score, + \Flat\APIClient\Model\ScoreTrackCreation $body, + string $contentType = self::contentTypes['addScoreTrack'][0] + ): \Flat\APIClient\Model\ScoreTrackCreationResponse|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->addScoreTrackWithHttpInfo($score, $body, $contentType); + return $response; + } + + /** + * Operation addScoreTrackWithHttpInfo + * + * Add a new video or audio track to the score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreTrackCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addScoreTrack'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ScoreTrackCreationResponse|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function addScoreTrackWithHttpInfo( + string $score, + \Flat\APIClient\Model\ScoreTrackCreation $body, + string $contentType = self::contentTypes['addScoreTrack'][0] + ): array + { + $request = $this->addScoreTrackRequest($score, $body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreTrackCreationResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreTrackCreationResponse', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ScoreTrackCreationResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation addScoreTrackAsync + * + * Add a new video or audio track to the score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreTrackCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addScoreTrack'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function addScoreTrackAsync( + string $score, + \Flat\APIClient\Model\ScoreTrackCreation $body, + string $contentType = self::contentTypes['addScoreTrack'][0] + ): PromiseInterface + { + return $this->addScoreTrackAsyncWithHttpInfo($score, $body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addScoreTrackAsyncWithHttpInfo + * + * Add a new video or audio track to the score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreTrackCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addScoreTrack'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function addScoreTrackAsyncWithHttpInfo( + string $score, + \Flat\APIClient\Model\ScoreTrackCreation $body, + string $contentType = self::contentTypes['addScoreTrack'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ScoreTrackCreationResponse'; + $request = $this->addScoreTrackRequest($score, $body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'addScoreTrack' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreTrackCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addScoreTrack'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function addScoreTrackRequest( + string $score, + \Flat\APIClient\Model\ScoreTrackCreation $body, + string $contentType = self::contentTypes['addScoreTrack'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling addScoreTrack' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling addScoreTrack' + ); + } + + $resourcePath = '/scores/{score}/tracks'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createExportTask + * + * Create a new score export task + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + * @param string $format The format of the file that will be generated or the target service name where the file will be exported (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param \Flat\APIClient\Model\TaskExportOptions|null $body body (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createExportTask'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\Task|\Flat\APIClient\Model\FlatErrorResponse + */ + public function createExportTask( + string $score, + string $revision, + string $format, + ?string $sharing_key = null, + ?\Flat\APIClient\Model\TaskExportOptions $body = null, + string $contentType = self::contentTypes['createExportTask'][0] + ): \Flat\APIClient\Model\Task|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->createExportTaskWithHttpInfo($score, $revision, $format, $sharing_key, $body, $contentType); + return $response; + } + + /** + * Operation createExportTaskWithHttpInfo + * + * Create a new score export task + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + * @param string $format The format of the file that will be generated or the target service name where the file will be exported (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param \Flat\APIClient\Model\TaskExportOptions|null $body (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createExportTask'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\Task|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createExportTaskWithHttpInfo( + string $score, + string $revision, + string $format, + ?string $sharing_key = null, + ?\Flat\APIClient\Model\TaskExportOptions $body = null, + string $contentType = self::contentTypes['createExportTask'][0] + ): array + { + $request = $this->createExportTaskRequest($score, $revision, $format, $sharing_key, $body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Task', + $request, + $response, + ); + case 402: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Task', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\Task', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createExportTaskAsync + * + * Create a new score export task + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + * @param string $format The format of the file that will be generated or the target service name where the file will be exported (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param \Flat\APIClient\Model\TaskExportOptions|null $body (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createExportTask'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createExportTaskAsync( + string $score, + string $revision, + string $format, + ?string $sharing_key = null, + ?\Flat\APIClient\Model\TaskExportOptions $body = null, + string $contentType = self::contentTypes['createExportTask'][0] + ): PromiseInterface + { + return $this->createExportTaskAsyncWithHttpInfo($score, $revision, $format, $sharing_key, $body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createExportTaskAsyncWithHttpInfo + * + * Create a new score export task + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + * @param string $format The format of the file that will be generated or the target service name where the file will be exported (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param \Flat\APIClient\Model\TaskExportOptions|null $body (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createExportTask'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createExportTaskAsyncWithHttpInfo( + string $score, + string $revision, + string $format, + ?string $sharing_key = null, + ?\Flat\APIClient\Model\TaskExportOptions $body = null, + string $contentType = self::contentTypes['createExportTask'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\Task'; + $request = $this->createExportTaskRequest($score, $revision, $format, $sharing_key, $body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createExportTask' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + * @param string $format The format of the file that will be generated or the target service name where the file will be exported (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param \Flat\APIClient\Model\TaskExportOptions|null $body (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createExportTask'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createExportTaskRequest( + string $score, + string $revision, + string $format, + ?string $sharing_key = null, + ?\Flat\APIClient\Model\TaskExportOptions $body = null, + string $contentType = self::contentTypes['createExportTask'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling createExportTask' + ); + } + // verify the required parameter 'revision' is set + if ($revision === null || (is_array($revision) && count($revision) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $revision when calling createExportTask' + ); + } + // verify the required parameter 'format' is set + if ($format === null || (is_array($format) && count($format) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $format when calling createExportTask' + ); + } + + $resourcePath = '/scores/{score}/revisions/{revision}/{format}/task'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sharing_key, + 'sharingKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + // path params + if ($revision !== null) { + $resourcePath = str_replace( + '{revision}', + ObjectSerializer::toPathValue($revision), + $resourcePath + ); + } + // path params + if ($format !== null) { + $resourcePath = str_replace( + '{format}', + ObjectSerializer::toPathValue($format), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createScore + * + * Create a new score + * + * @param \Flat\APIClient\Model\ScoreCreationBuilderData|\Flat\APIClient\Model\ScoreCreationFileImport|\Flat\APIClient\Model\ScoreCreationGoogleDriveImport $body body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createScore'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ScoreDetails|\Flat\APIClient\Model\Task|\Flat\APIClient\Model\FlatErrorResponse + */ + public function createScore( + \Flat\APIClient\Model\ScoreCreationBuilderData|\Flat\APIClient\Model\ScoreCreationFileImport|\Flat\APIClient\Model\ScoreCreationGoogleDriveImport $body, + string $contentType = self::contentTypes['createScore'][0] + ): \Flat\APIClient\Model\ScoreDetails|\Flat\APIClient\Model\Task|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->createScoreWithHttpInfo($body, $contentType); + return $response; + } + + /** + * Operation createScoreWithHttpInfo + * + * Create a new score + * + * @param \Flat\APIClient\Model\ScoreCreationBuilderData|\Flat\APIClient\Model\ScoreCreationFileImport|\Flat\APIClient\Model\ScoreCreationGoogleDriveImport $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createScore'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ScoreDetails|\Flat\APIClient\Model\Task|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createScoreWithHttpInfo( + \Flat\APIClient\Model\ScoreCreationBuilderData|\Flat\APIClient\Model\ScoreCreationFileImport|\Flat\APIClient\Model\ScoreCreationGoogleDriveImport $body, + string $contentType = self::contentTypes['createScore'][0] + ): array + { + $request = $this->createScoreRequest($body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails', + $request, + $response, + ); + case 202: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Task', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 402: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ScoreDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\Task', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createScoreAsync + * + * Create a new score + * + * @param \Flat\APIClient\Model\ScoreCreationBuilderData|\Flat\APIClient\Model\ScoreCreationFileImport|\Flat\APIClient\Model\ScoreCreationGoogleDriveImport $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createScore'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createScoreAsync( + \Flat\APIClient\Model\ScoreCreationBuilderData|\Flat\APIClient\Model\ScoreCreationFileImport|\Flat\APIClient\Model\ScoreCreationGoogleDriveImport $body, + string $contentType = self::contentTypes['createScore'][0] + ): PromiseInterface + { + return $this->createScoreAsyncWithHttpInfo($body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createScoreAsyncWithHttpInfo + * + * Create a new score + * + * @param \Flat\APIClient\Model\ScoreCreationBuilderData|\Flat\APIClient\Model\ScoreCreationFileImport|\Flat\APIClient\Model\ScoreCreationGoogleDriveImport $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createScore'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createScoreAsyncWithHttpInfo( + \Flat\APIClient\Model\ScoreCreationBuilderData|\Flat\APIClient\Model\ScoreCreationFileImport|\Flat\APIClient\Model\ScoreCreationGoogleDriveImport $body, + string $contentType = self::contentTypes['createScore'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ScoreDetails'; + $request = $this->createScoreRequest($body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createScore' + * + * @param \Flat\APIClient\Model\ScoreCreationBuilderData|\Flat\APIClient\Model\ScoreCreationFileImport|\Flat\APIClient\Model\ScoreCreationGoogleDriveImport $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createScore'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createScoreRequest( + \Flat\APIClient\Model\ScoreCreationBuilderData|\Flat\APIClient\Model\ScoreCreationFileImport|\Flat\APIClient\Model\ScoreCreationGoogleDriveImport $body, + string $contentType = self::contentTypes['createScore'][0] + ): Request + { + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling createScore' + ); + } + + $resourcePath = '/scores'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createScoreRevision + * + * Create a new revision + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreRevisionCreation $body body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createScoreRevision'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ScoreRevision|\Flat\APIClient\Model\FlatErrorResponse + */ + public function createScoreRevision( + string $score, + \Flat\APIClient\Model\ScoreRevisionCreation $body, + string $contentType = self::contentTypes['createScoreRevision'][0] + ): \Flat\APIClient\Model\ScoreRevision|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->createScoreRevisionWithHttpInfo($score, $body, $contentType); + return $response; + } + + /** + * Operation createScoreRevisionWithHttpInfo + * + * Create a new revision + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreRevisionCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createScoreRevision'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ScoreRevision|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createScoreRevisionWithHttpInfo( + string $score, + \Flat\APIClient\Model\ScoreRevisionCreation $body, + string $contentType = self::contentTypes['createScoreRevision'][0] + ): array + { + $request = $this->createScoreRevisionRequest($score, $body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreRevision', + $request, + $response, + ); + case 402: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreRevision', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ScoreRevision', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createScoreRevisionAsync + * + * Create a new revision + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreRevisionCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createScoreRevision'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createScoreRevisionAsync( + string $score, + \Flat\APIClient\Model\ScoreRevisionCreation $body, + string $contentType = self::contentTypes['createScoreRevision'][0] + ): PromiseInterface + { + return $this->createScoreRevisionAsyncWithHttpInfo($score, $body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createScoreRevisionAsyncWithHttpInfo + * + * Create a new revision + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreRevisionCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createScoreRevision'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createScoreRevisionAsyncWithHttpInfo( + string $score, + \Flat\APIClient\Model\ScoreRevisionCreation $body, + string $contentType = self::contentTypes['createScoreRevision'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ScoreRevision'; + $request = $this->createScoreRevisionRequest($score, $body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createScoreRevision' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreRevisionCreation $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createScoreRevision'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createScoreRevisionRequest( + string $score, + \Flat\APIClient\Model\ScoreRevisionCreation $body, + string $contentType = self::contentTypes['createScoreRevision'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling createScoreRevision' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling createScoreRevision' + ); + } + + $resourcePath = '/scores/{score}/revisions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteScore + * + * Delete a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param bool|null $now If `true`, the score deletion will be scheduled to be done ASAP (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScore'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\FlatErrorResponse|null + */ + public function deleteScore( + string $score, + ?bool $now = false, + string $contentType = self::contentTypes['deleteScore'][0] + ): ?\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->deleteScoreWithHttpInfo($score, $now, $contentType); + return $response; + } + + /** + * Operation deleteScoreWithHttpInfo + * + * Delete a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param bool|null $now If `true`, the score deletion will be scheduled to be done ASAP (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScore'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function deleteScoreWithHttpInfo( + string $score, + ?bool $now = false, + string $contentType = self::contentTypes['deleteScore'][0] + ): array + { + $request = $this->deleteScoreRequest($score, $now, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation deleteScoreAsync + * + * Delete a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param bool|null $now If `true`, the score deletion will be scheduled to be done ASAP (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScore'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteScoreAsync( + string $score, + ?bool $now = false, + string $contentType = self::contentTypes['deleteScore'][0] + ): PromiseInterface + { + return $this->deleteScoreAsyncWithHttpInfo($score, $now, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteScoreAsyncWithHttpInfo + * + * Delete a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param bool|null $now If `true`, the score deletion will be scheduled to be done ASAP (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScore'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteScoreAsyncWithHttpInfo( + string $score, + ?bool $now = false, + string $contentType = self::contentTypes['deleteScore'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deleteScoreRequest($score, $now, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteScore' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param bool|null $now If `true`, the score deletion will be scheduled to be done ASAP (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScore'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteScoreRequest( + string $score, + ?bool $now = false, + string $contentType = self::contentTypes['deleteScore'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling deleteScore' + ); + } + + $resourcePath = '/scores/{score}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $now, + 'now', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteScoreComment + * + * Delete a comment + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $comment Unique identifier of a sheet music comment (required) + * @param string|null $event_properties Optional analytics properties merged into XP tracking for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` (optional) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScoreComment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\FlatErrorResponse|null + */ + public function deleteScoreComment( + string $score, + string $comment, + ?string $event_properties = null, + ?string $sharing_key = null, + string $contentType = self::contentTypes['deleteScoreComment'][0] + ): ?\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->deleteScoreCommentWithHttpInfo($score, $comment, $event_properties, $sharing_key, $contentType); + return $response; + } + + /** + * Operation deleteScoreCommentWithHttpInfo + * + * Delete a comment + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $comment Unique identifier of a sheet music comment (required) + * @param string|null $event_properties Optional analytics properties merged into XP tracking for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` (optional) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScoreComment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function deleteScoreCommentWithHttpInfo( + string $score, + string $comment, + ?string $event_properties = null, + ?string $sharing_key = null, + string $contentType = self::contentTypes['deleteScoreComment'][0] + ): array + { + $request = $this->deleteScoreCommentRequest($score, $comment, $event_properties, $sharing_key, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation deleteScoreCommentAsync + * + * Delete a comment + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $comment Unique identifier of a sheet music comment (required) + * @param string|null $event_properties Optional analytics properties merged into XP tracking for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` (optional) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScoreComment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteScoreCommentAsync( + string $score, + string $comment, + ?string $event_properties = null, + ?string $sharing_key = null, + string $contentType = self::contentTypes['deleteScoreComment'][0] + ): PromiseInterface + { + return $this->deleteScoreCommentAsyncWithHttpInfo($score, $comment, $event_properties, $sharing_key, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteScoreCommentAsyncWithHttpInfo + * + * Delete a comment + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $comment Unique identifier of a sheet music comment (required) + * @param string|null $event_properties Optional analytics properties merged into XP tracking for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` (optional) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScoreComment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteScoreCommentAsyncWithHttpInfo( + string $score, + string $comment, + ?string $event_properties = null, + ?string $sharing_key = null, + string $contentType = self::contentTypes['deleteScoreComment'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deleteScoreCommentRequest($score, $comment, $event_properties, $sharing_key, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteScoreComment' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $comment Unique identifier of a sheet music comment (required) + * @param string|null $event_properties Optional analytics properties merged into XP tracking for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` (optional) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScoreComment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteScoreCommentRequest( + string $score, + string $comment, + ?string $event_properties = null, + ?string $sharing_key = null, + string $contentType = self::contentTypes['deleteScoreComment'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling deleteScoreComment' + ); + } + // verify the required parameter 'comment' is set + if ($comment === null || (is_array($comment) && count($comment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $comment when calling deleteScoreComment' + ); + } + + $resourcePath = '/scores/{score}/comments/{comment}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $event_properties, + 'eventProperties', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sharing_key, + 'sharingKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + // path params + if ($comment !== null) { + $resourcePath = str_replace( + '{comment}', + ObjectSerializer::toPathValue($comment), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteScoreTrack + * + * Remove an audio or video track linked to the score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $track Unique identifier of a score audio track (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScoreTrack'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\FlatErrorResponse|null + */ + public function deleteScoreTrack( + string $score, + string $track, + string $contentType = self::contentTypes['deleteScoreTrack'][0] + ): ?\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->deleteScoreTrackWithHttpInfo($score, $track, $contentType); + return $response; + } + + /** + * Operation deleteScoreTrackWithHttpInfo + * + * Remove an audio or video track linked to the score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $track Unique identifier of a score audio track (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScoreTrack'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function deleteScoreTrackWithHttpInfo( + string $score, + string $track, + string $contentType = self::contentTypes['deleteScoreTrack'][0] + ): array + { + $request = $this->deleteScoreTrackRequest($score, $track, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation deleteScoreTrackAsync + * + * Remove an audio or video track linked to the score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $track Unique identifier of a score audio track (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScoreTrack'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteScoreTrackAsync( + string $score, + string $track, + string $contentType = self::contentTypes['deleteScoreTrack'][0] + ): PromiseInterface + { + return $this->deleteScoreTrackAsyncWithHttpInfo($score, $track, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteScoreTrackAsyncWithHttpInfo + * + * Remove an audio or video track linked to the score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $track Unique identifier of a score audio track (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScoreTrack'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteScoreTrackAsyncWithHttpInfo( + string $score, + string $track, + string $contentType = self::contentTypes['deleteScoreTrack'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deleteScoreTrackRequest($score, $track, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteScoreTrack' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $track Unique identifier of a score audio track (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteScoreTrack'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteScoreTrackRequest( + string $score, + string $track, + string $contentType = self::contentTypes['deleteScoreTrack'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling deleteScoreTrack' + ); + } + // verify the required parameter 'track' is set + if ($track === null || (is_array($track) && count($track) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $track when calling deleteScoreTrack' + ); + } + + $resourcePath = '/scores/{score}/tracks/{track}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + // path params + if ($track !== null) { + $resourcePath = str_replace( + '{track}', + ObjectSerializer::toPathValue($track), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation editScore + * + * Edit a score's metadata + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreModification $body body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['editScore'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ScoreDetails|\Flat\APIClient\Model\FlatErrorResponse + */ + public function editScore( + string $score, + \Flat\APIClient\Model\ScoreModification $body, + string $contentType = self::contentTypes['editScore'][0] + ): \Flat\APIClient\Model\ScoreDetails|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->editScoreWithHttpInfo($score, $body, $contentType); + return $response; + } + + /** + * Operation editScoreWithHttpInfo + * + * Edit a score's metadata + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreModification $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['editScore'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ScoreDetails|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function editScoreWithHttpInfo( + string $score, + \Flat\APIClient\Model\ScoreModification $body, + string $contentType = self::contentTypes['editScore'][0] + ): array + { + $request = $this->editScoreRequest($score, $body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails', + $request, + $response, + ); + case 402: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ScoreDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation editScoreAsync + * + * Edit a score's metadata + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreModification $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['editScore'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function editScoreAsync( + string $score, + \Flat\APIClient\Model\ScoreModification $body, + string $contentType = self::contentTypes['editScore'][0] + ): PromiseInterface + { + return $this->editScoreAsyncWithHttpInfo($score, $body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation editScoreAsyncWithHttpInfo + * + * Edit a score's metadata + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreModification $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['editScore'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function editScoreAsyncWithHttpInfo( + string $score, + \Flat\APIClient\Model\ScoreModification $body, + string $contentType = self::contentTypes['editScore'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ScoreDetails'; + $request = $this->editScoreRequest($score, $body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'editScore' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreModification $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['editScore'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function editScoreRequest( + string $score, + \Flat\APIClient\Model\ScoreModification $body, + string $contentType = self::contentTypes['editScore'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling editScore' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling editScore' + ); + } + + $resourcePath = '/scores/{score}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation forkScore + * + * Fork a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreFork $body body (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['forkScore'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ScoreDetails|\Flat\APIClient\Model\FlatErrorResponse + */ + public function forkScore( + string $score, + \Flat\APIClient\Model\ScoreFork $body, + ?string $sharing_key = null, + string $contentType = self::contentTypes['forkScore'][0] + ): \Flat\APIClient\Model\ScoreDetails|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->forkScoreWithHttpInfo($score, $body, $sharing_key, $contentType); + return $response; + } + + /** + * Operation forkScoreWithHttpInfo + * + * Fork a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreFork $body (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['forkScore'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ScoreDetails|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function forkScoreWithHttpInfo( + string $score, + \Flat\APIClient\Model\ScoreFork $body, + ?string $sharing_key = null, + string $contentType = self::contentTypes['forkScore'][0] + ): array + { + $request = $this->forkScoreRequest($score, $body, $sharing_key, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails', + $request, + $response, + ); + case 402: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ScoreDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation forkScoreAsync + * + * Fork a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreFork $body (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['forkScore'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function forkScoreAsync( + string $score, + \Flat\APIClient\Model\ScoreFork $body, + ?string $sharing_key = null, + string $contentType = self::contentTypes['forkScore'][0] + ): PromiseInterface + { + return $this->forkScoreAsyncWithHttpInfo($score, $body, $sharing_key, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation forkScoreAsyncWithHttpInfo + * + * Fork a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreFork $body (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['forkScore'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function forkScoreAsyncWithHttpInfo( + string $score, + \Flat\APIClient\Model\ScoreFork $body, + ?string $sharing_key = null, + string $contentType = self::contentTypes['forkScore'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ScoreDetails'; + $request = $this->forkScoreRequest($score, $body, $sharing_key, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'forkScore' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreFork $body (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['forkScore'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function forkScoreRequest( + string $score, + \Flat\APIClient\Model\ScoreFork $body, + ?string $sharing_key = null, + string $contentType = self::contentTypes['forkScore'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling forkScore' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling forkScore' + ); + } + + $resourcePath = '/scores/{score}/fork'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sharing_key, + 'sharingKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getGroupScores + * + * List group's scores + * + * @param string $group Unique identifier of a Flat group (required) + * @param string|null $parent Filter the score forked from the score id `parent` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupScores'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ScoreDetails[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getGroupScores( + string $group, + ?string $parent = null, + string $contentType = self::contentTypes['getGroupScores'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getGroupScoresWithHttpInfo($group, $parent, $contentType); + return $response; + } + + /** + * Operation getGroupScoresWithHttpInfo + * + * List group's scores + * + * @param string $group Unique identifier of a Flat group (required) + * @param string|null $parent Filter the score forked from the score id `parent` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupScores'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ScoreDetails[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getGroupScoresWithHttpInfo( + string $group, + ?string $parent = null, + string $contentType = self::contentTypes['getGroupScores'][0] + ): array + { + $request = $this->getGroupScoresRequest($group, $parent, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails[]', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ScoreDetails[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getGroupScoresAsync + * + * List group's scores + * + * @param string $group Unique identifier of a Flat group (required) + * @param string|null $parent Filter the score forked from the score id `parent` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupScores'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getGroupScoresAsync( + string $group, + ?string $parent = null, + string $contentType = self::contentTypes['getGroupScores'][0] + ): PromiseInterface + { + return $this->getGroupScoresAsyncWithHttpInfo($group, $parent, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getGroupScoresAsyncWithHttpInfo + * + * List group's scores + * + * @param string $group Unique identifier of a Flat group (required) + * @param string|null $parent Filter the score forked from the score id `parent` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupScores'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getGroupScoresAsyncWithHttpInfo( + string $group, + ?string $parent = null, + string $contentType = self::contentTypes['getGroupScores'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ScoreDetails[]'; + $request = $this->getGroupScoresRequest($group, $parent, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getGroupScores' + * + * @param string $group Unique identifier of a Flat group (required) + * @param string|null $parent Filter the score forked from the score id `parent` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupScores'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getGroupScoresRequest( + string $group, + ?string $parent = null, + string $contentType = self::contentTypes['getGroupScores'][0] + ): Request + { + // verify the required parameter 'group' is set + if ($group === null || (is_array($group) && count($group) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $group when calling getGroupScores' + ); + } + + $resourcePath = '/groups/{group}/scores'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $parent, + 'parent', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($group !== null) { + $resourcePath = str_replace( + '{group}', + ObjectSerializer::toPathValue($group), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getScore + * + * Get a score's metadata + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScore'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ScoreDetails|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getScore( + string $score, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScore'][0] + ): \Flat\APIClient\Model\ScoreDetails|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getScoreWithHttpInfo($score, $sharing_key, $contentType); + return $response; + } + + /** + * Operation getScoreWithHttpInfo + * + * Get a score's metadata + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScore'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ScoreDetails|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getScoreWithHttpInfo( + string $score, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScore'][0] + ): array + { + $request = $this->getScoreRequest($score, $sharing_key, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails', + $request, + $response, + ); + case 402: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ScoreDetails', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getScoreAsync + * + * Get a score's metadata + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScore'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getScoreAsync( + string $score, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScore'][0] + ): PromiseInterface + { + return $this->getScoreAsyncWithHttpInfo($score, $sharing_key, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getScoreAsyncWithHttpInfo + * + * Get a score's metadata + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScore'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getScoreAsyncWithHttpInfo( + string $score, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScore'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ScoreDetails'; + $request = $this->getScoreRequest($score, $sharing_key, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getScore' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScore'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getScoreRequest( + string $score, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScore'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling getScore' + ); + } + + $resourcePath = '/scores/{score}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sharing_key, + 'sharingKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getScoreCollaborator + * + * Get a collaborator + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $collaborator Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreCollaborator'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ResourceCollaborator|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getScoreCollaborator( + string $score, + string $collaborator, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreCollaborator'][0] + ): \Flat\APIClient\Model\ResourceCollaborator|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getScoreCollaboratorWithHttpInfo($score, $collaborator, $sharing_key, $contentType); + return $response; + } + + /** + * Operation getScoreCollaboratorWithHttpInfo + * + * Get a collaborator + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $collaborator Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreCollaborator'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ResourceCollaborator|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getScoreCollaboratorWithHttpInfo( + string $score, + string $collaborator, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreCollaborator'][0] + ): array + { + $request = $this->getScoreCollaboratorRequest($score, $collaborator, $sharing_key, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ResourceCollaborator', + $request, + $response, + ); + case 402: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ResourceCollaborator', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ResourceCollaborator', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getScoreCollaboratorAsync + * + * Get a collaborator + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $collaborator Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreCollaborator'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getScoreCollaboratorAsync( + string $score, + string $collaborator, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreCollaborator'][0] + ): PromiseInterface + { + return $this->getScoreCollaboratorAsyncWithHttpInfo($score, $collaborator, $sharing_key, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getScoreCollaboratorAsyncWithHttpInfo + * + * Get a collaborator + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $collaborator Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreCollaborator'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getScoreCollaboratorAsyncWithHttpInfo( + string $score, + string $collaborator, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreCollaborator'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ResourceCollaborator'; + $request = $this->getScoreCollaboratorRequest($score, $collaborator, $sharing_key, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getScoreCollaborator' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $collaborator Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreCollaborator'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getScoreCollaboratorRequest( + string $score, + string $collaborator, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreCollaborator'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling getScoreCollaborator' + ); + } + // verify the required parameter 'collaborator' is set + if ($collaborator === null || (is_array($collaborator) && count($collaborator) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $collaborator when calling getScoreCollaborator' + ); + } + + $resourcePath = '/scores/{score}/collaborators/{collaborator}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sharing_key, + 'sharingKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + // path params + if ($collaborator !== null) { + $resourcePath = str_replace( + '{collaborator}', + ObjectSerializer::toPathValue($collaborator), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getScoreCollaborators + * + * List the collaborators + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreCollaborators'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ResourceCollaborator[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getScoreCollaborators( + string $score, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreCollaborators'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getScoreCollaboratorsWithHttpInfo($score, $sharing_key, $contentType); + return $response; + } + + /** + * Operation getScoreCollaboratorsWithHttpInfo + * + * List the collaborators + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreCollaborators'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ResourceCollaborator[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getScoreCollaboratorsWithHttpInfo( + string $score, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreCollaborators'][0] + ): array + { + $request = $this->getScoreCollaboratorsRequest($score, $sharing_key, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ResourceCollaborator[]', + $request, + $response, + ); + case 402: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ResourceCollaborator[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ResourceCollaborator[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getScoreCollaboratorsAsync + * + * List the collaborators + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreCollaborators'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getScoreCollaboratorsAsync( + string $score, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreCollaborators'][0] + ): PromiseInterface + { + return $this->getScoreCollaboratorsAsyncWithHttpInfo($score, $sharing_key, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getScoreCollaboratorsAsyncWithHttpInfo + * + * List the collaborators + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreCollaborators'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getScoreCollaboratorsAsyncWithHttpInfo( + string $score, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreCollaborators'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ResourceCollaborator[]'; + $request = $this->getScoreCollaboratorsRequest($score, $sharing_key, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getScoreCollaborators' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreCollaborators'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getScoreCollaboratorsRequest( + string $score, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreCollaborators'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling getScoreCollaborators' + ); + } + + $resourcePath = '/scores/{score}/collaborators'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sharing_key, + 'sharingKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getScoreComments + * + * List comments + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $type Filter the comments by type (optional) + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreComments'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ScoreComment[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getScoreComments( + string $score, + ?string $type = null, + ?string $sort = null, + ?string $direction = null, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreComments'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getScoreCommentsWithHttpInfo($score, $type, $sort, $direction, $sharing_key, $contentType); + return $response; + } + + /** + * Operation getScoreCommentsWithHttpInfo + * + * List comments + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $type Filter the comments by type (optional) + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreComments'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ScoreComment[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getScoreCommentsWithHttpInfo( + string $score, + ?string $type = null, + ?string $sort = null, + ?string $direction = null, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreComments'][0] + ): array + { + $request = $this->getScoreCommentsRequest($score, $type, $sort, $direction, $sharing_key, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreComment[]', + $request, + $response, + ); + case 402: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreComment[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ScoreComment[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getScoreCommentsAsync + * + * List comments + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $type Filter the comments by type (optional) + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreComments'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getScoreCommentsAsync( + string $score, + ?string $type = null, + ?string $sort = null, + ?string $direction = null, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreComments'][0] + ): PromiseInterface + { + return $this->getScoreCommentsAsyncWithHttpInfo($score, $type, $sort, $direction, $sharing_key, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getScoreCommentsAsyncWithHttpInfo + * + * List comments + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $type Filter the comments by type (optional) + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreComments'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getScoreCommentsAsyncWithHttpInfo( + string $score, + ?string $type = null, + ?string $sort = null, + ?string $direction = null, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreComments'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ScoreComment[]'; + $request = $this->getScoreCommentsRequest($score, $type, $sort, $direction, $sharing_key, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getScoreComments' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $type Filter the comments by type (optional) + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreComments'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getScoreCommentsRequest( + string $score, + ?string $type = null, + ?string $sort = null, + ?string $direction = null, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreComments'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling getScoreComments' + ); + } + + $resourcePath = '/scores/{score}/comments'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $type, + 'type', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $direction, + 'direction', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sharing_key, + 'sharingKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getScoreRevision + * + * Get a score revision + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreRevision'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ScoreRevision|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getScoreRevision( + string $score, + string $revision, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreRevision'][0] + ): \Flat\APIClient\Model\ScoreRevision|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getScoreRevisionWithHttpInfo($score, $revision, $sharing_key, $contentType); + return $response; + } + + /** + * Operation getScoreRevisionWithHttpInfo + * + * Get a score revision + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreRevision'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ScoreRevision|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getScoreRevisionWithHttpInfo( + string $score, + string $revision, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreRevision'][0] + ): array + { + $request = $this->getScoreRevisionRequest($score, $revision, $sharing_key, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreRevision', + $request, + $response, + ); + case 402: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreRevision', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ScoreRevision', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getScoreRevisionAsync + * + * Get a score revision + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreRevision'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getScoreRevisionAsync( + string $score, + string $revision, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreRevision'][0] + ): PromiseInterface + { + return $this->getScoreRevisionAsyncWithHttpInfo($score, $revision, $sharing_key, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getScoreRevisionAsyncWithHttpInfo + * + * Get a score revision + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreRevision'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getScoreRevisionAsyncWithHttpInfo( + string $score, + string $revision, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreRevision'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ScoreRevision'; + $request = $this->getScoreRevisionRequest($score, $revision, $sharing_key, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getScoreRevision' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreRevision'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getScoreRevisionRequest( + string $score, + string $revision, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreRevision'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling getScoreRevision' + ); + } + // verify the required parameter 'revision' is set + if ($revision === null || (is_array($revision) && count($revision) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $revision when calling getScoreRevision' + ); + } + + $resourcePath = '/scores/{score}/revisions/{revision}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sharing_key, + 'sharingKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + // path params + if ($revision !== null) { + $resourcePath = str_replace( + '{revision}', + ObjectSerializer::toPathValue($revision), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getScoreRevisionData + * + * Get a score revision data + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + * @param string $format The format of the file you will retrieve (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string|null $parts An optional a set of parts uuid to be exported. This parameter must be composed of parts uuids separated by commas. For example \"59df645f-bb1c-f1b4-b573-d2afc4491f94,34ef645f-1aef-f3bc-1564-34cca4492b87\". (optional) + * @param bool|null $default_track When `format` is `mp3`, this property is set to true and the score has a default `ScoreTrack` (mp3), this one will be returned instead of the playback file. (optional) + * @param bool|null $url Returns a json with the `url` in it instead of redirecting (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreRevisionData'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \SplFileObject|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getScoreRevisionData( + string $score, + string $revision, + string $format, + ?string $sharing_key = null, + ?string $parts = null, + ?bool $default_track = null, + ?bool $url = null, + string $contentType = self::contentTypes['getScoreRevisionData'][0] + ): \SplFileObject|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getScoreRevisionDataWithHttpInfo($score, $revision, $format, $sharing_key, $parts, $default_track, $url, $contentType); + return $response; + } + + /** + * Operation getScoreRevisionDataWithHttpInfo + * + * Get a score revision data + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + * @param string $format The format of the file you will retrieve (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string|null $parts An optional a set of parts uuid to be exported. This parameter must be composed of parts uuids separated by commas. For example \"59df645f-bb1c-f1b4-b573-d2afc4491f94,34ef645f-1aef-f3bc-1564-34cca4492b87\". (optional) + * @param bool|null $default_track When `format` is `mp3`, this property is set to true and the score has a default `ScoreTrack` (mp3), this one will be returned instead of the playback file. (optional) + * @param bool|null $url Returns a json with the `url` in it instead of redirecting (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreRevisionData'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \SplFileObject|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getScoreRevisionDataWithHttpInfo( + string $score, + string $revision, + string $format, + ?string $sharing_key = null, + ?string $parts = null, + ?bool $default_track = null, + ?bool $url = null, + string $contentType = self::contentTypes['getScoreRevisionData'][0] + ): array + { + $request = $this->getScoreRevisionDataRequest($score, $revision, $format, $sharing_key, $parts, $default_track, $url, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\SplFileObject', + $request, + $response, + ); + case 402: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\SplFileObject', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SplFileObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getScoreRevisionDataAsync + * + * Get a score revision data + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + * @param string $format The format of the file you will retrieve (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string|null $parts An optional a set of parts uuid to be exported. This parameter must be composed of parts uuids separated by commas. For example \"59df645f-bb1c-f1b4-b573-d2afc4491f94,34ef645f-1aef-f3bc-1564-34cca4492b87\". (optional) + * @param bool|null $default_track When `format` is `mp3`, this property is set to true and the score has a default `ScoreTrack` (mp3), this one will be returned instead of the playback file. (optional) + * @param bool|null $url Returns a json with the `url` in it instead of redirecting (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreRevisionData'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getScoreRevisionDataAsync( + string $score, + string $revision, + string $format, + ?string $sharing_key = null, + ?string $parts = null, + ?bool $default_track = null, + ?bool $url = null, + string $contentType = self::contentTypes['getScoreRevisionData'][0] + ): PromiseInterface + { + return $this->getScoreRevisionDataAsyncWithHttpInfo($score, $revision, $format, $sharing_key, $parts, $default_track, $url, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getScoreRevisionDataAsyncWithHttpInfo + * + * Get a score revision data + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + * @param string $format The format of the file you will retrieve (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string|null $parts An optional a set of parts uuid to be exported. This parameter must be composed of parts uuids separated by commas. For example \"59df645f-bb1c-f1b4-b573-d2afc4491f94,34ef645f-1aef-f3bc-1564-34cca4492b87\". (optional) + * @param bool|null $default_track When `format` is `mp3`, this property is set to true and the score has a default `ScoreTrack` (mp3), this one will be returned instead of the playback file. (optional) + * @param bool|null $url Returns a json with the `url` in it instead of redirecting (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreRevisionData'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getScoreRevisionDataAsyncWithHttpInfo( + string $score, + string $revision, + string $format, + ?string $sharing_key = null, + ?string $parts = null, + ?bool $default_track = null, + ?bool $url = null, + string $contentType = self::contentTypes['getScoreRevisionData'][0] + ): PromiseInterface + { + $returnType = '\SplFileObject'; + $request = $this->getScoreRevisionDataRequest($score, $revision, $format, $sharing_key, $parts, $default_track, $url, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getScoreRevisionData' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $revision Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + * @param string $format The format of the file you will retrieve (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string|null $parts An optional a set of parts uuid to be exported. This parameter must be composed of parts uuids separated by commas. For example \"59df645f-bb1c-f1b4-b573-d2afc4491f94,34ef645f-1aef-f3bc-1564-34cca4492b87\". (optional) + * @param bool|null $default_track When `format` is `mp3`, this property is set to true and the score has a default `ScoreTrack` (mp3), this one will be returned instead of the playback file. (optional) + * @param bool|null $url Returns a json with the `url` in it instead of redirecting (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreRevisionData'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getScoreRevisionDataRequest( + string $score, + string $revision, + string $format, + ?string $sharing_key = null, + ?string $parts = null, + ?bool $default_track = null, + ?bool $url = null, + string $contentType = self::contentTypes['getScoreRevisionData'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling getScoreRevisionData' + ); + } + // verify the required parameter 'revision' is set + if ($revision === null || (is_array($revision) && count($revision) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $revision when calling getScoreRevisionData' + ); + } + // verify the required parameter 'format' is set + if ($format === null || (is_array($format) && count($format) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $format when calling getScoreRevisionData' + ); + } + + $resourcePath = '/scores/{score}/revisions/{revision}/{format}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sharing_key, + 'sharingKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $parts, + 'parts', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $default_track, + 'defaultTrack', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $url, + 'url', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + // path params + if ($revision !== null) { + $resourcePath = str_replace( + '{revision}', + ObjectSerializer::toPathValue($revision), + $resourcePath + ); + } + // path params + if ($format !== null) { + $resourcePath = str_replace( + '{format}', + ObjectSerializer::toPathValue($format), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'application/vnd.recordare.musicxml+xml', 'application/vnd.recordare.musicxml', 'audio/mp3', 'audio/wav', 'audio/midi', 'image/png', 'application/octet-stream', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getScoreRevisions + * + * List the revisions + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreRevisions'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ScoreRevision[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getScoreRevisions( + string $score, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreRevisions'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getScoreRevisionsWithHttpInfo($score, $sharing_key, $contentType); + return $response; + } + + /** + * Operation getScoreRevisionsWithHttpInfo + * + * List the revisions + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreRevisions'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ScoreRevision[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getScoreRevisionsWithHttpInfo( + string $score, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreRevisions'][0] + ): array + { + $request = $this->getScoreRevisionsRequest($score, $sharing_key, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreRevision[]', + $request, + $response, + ); + case 402: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreRevision[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ScoreRevision[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getScoreRevisionsAsync + * + * List the revisions + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreRevisions'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getScoreRevisionsAsync( + string $score, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreRevisions'][0] + ): PromiseInterface + { + return $this->getScoreRevisionsAsyncWithHttpInfo($score, $sharing_key, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getScoreRevisionsAsyncWithHttpInfo + * + * List the revisions + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreRevisions'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getScoreRevisionsAsyncWithHttpInfo( + string $score, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreRevisions'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ScoreRevision[]'; + $request = $this->getScoreRevisionsRequest($score, $sharing_key, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getScoreRevisions' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreRevisions'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getScoreRevisionsRequest( + string $score, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreRevisions'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling getScoreRevisions' + ); + } + + $resourcePath = '/scores/{score}/revisions'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sharing_key, + 'sharingKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getScoreSubmissions + * + * List submissions related to the score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreSubmissions'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\AssignmentSubmission[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getScoreSubmissions( + string $score, + string $contentType = self::contentTypes['getScoreSubmissions'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getScoreSubmissionsWithHttpInfo($score, $contentType); + return $response; + } + + /** + * Operation getScoreSubmissionsWithHttpInfo + * + * List submissions related to the score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreSubmissions'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\AssignmentSubmission[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getScoreSubmissionsWithHttpInfo( + string $score, + string $contentType = self::contentTypes['getScoreSubmissions'][0] + ): array + { + $request = $this->getScoreSubmissionsRequest($score, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmission[]', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\AssignmentSubmission[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\AssignmentSubmission[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getScoreSubmissionsAsync + * + * List submissions related to the score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreSubmissions'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getScoreSubmissionsAsync( + string $score, + string $contentType = self::contentTypes['getScoreSubmissions'][0] + ): PromiseInterface + { + return $this->getScoreSubmissionsAsyncWithHttpInfo($score, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getScoreSubmissionsAsyncWithHttpInfo + * + * List submissions related to the score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreSubmissions'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getScoreSubmissionsAsyncWithHttpInfo( + string $score, + string $contentType = self::contentTypes['getScoreSubmissions'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\AssignmentSubmission[]'; + $request = $this->getScoreSubmissionsRequest($score, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getScoreSubmissions' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreSubmissions'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getScoreSubmissionsRequest( + string $score, + string $contentType = self::contentTypes['getScoreSubmissions'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling getScoreSubmissions' + ); + } + + $resourcePath = '/scores/{score}/submissions'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getScoreTrack + * + * Retrieve the details of an audio or video track linked to a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $track Unique identifier of a score audio track (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreTrack'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ScoreTrack|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getScoreTrack( + string $score, + string $track, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreTrack'][0] + ): \Flat\APIClient\Model\ScoreTrack|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getScoreTrackWithHttpInfo($score, $track, $sharing_key, $contentType); + return $response; + } + + /** + * Operation getScoreTrackWithHttpInfo + * + * Retrieve the details of an audio or video track linked to a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $track Unique identifier of a score audio track (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreTrack'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ScoreTrack|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getScoreTrackWithHttpInfo( + string $score, + string $track, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreTrack'][0] + ): array + { + $request = $this->getScoreTrackRequest($score, $track, $sharing_key, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreTrack', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreTrack', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ScoreTrack', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getScoreTrackAsync + * + * Retrieve the details of an audio or video track linked to a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $track Unique identifier of a score audio track (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreTrack'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getScoreTrackAsync( + string $score, + string $track, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreTrack'][0] + ): PromiseInterface + { + return $this->getScoreTrackAsyncWithHttpInfo($score, $track, $sharing_key, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getScoreTrackAsyncWithHttpInfo + * + * Retrieve the details of an audio or video track linked to a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $track Unique identifier of a score audio track (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreTrack'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getScoreTrackAsyncWithHttpInfo( + string $score, + string $track, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreTrack'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ScoreTrack'; + $request = $this->getScoreTrackRequest($score, $track, $sharing_key, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getScoreTrack' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $track Unique identifier of a score audio track (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScoreTrack'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getScoreTrackRequest( + string $score, + string $track, + ?string $sharing_key = null, + string $contentType = self::contentTypes['getScoreTrack'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling getScoreTrack' + ); + } + // verify the required parameter 'track' is set + if ($track === null || (is_array($track) && count($track) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $track when calling getScoreTrack' + ); + } + + $resourcePath = '/scores/{score}/tracks/{track}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sharing_key, + 'sharingKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + // path params + if ($track !== null) { + $resourcePath = str_replace( + '{track}', + ObjectSerializer::toPathValue($track), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getUserLikes + * + * List liked scores + * + * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param bool|null $ids Return only the identifiers of the scores (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserLikes'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ScoreDetails[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getUserLikes( + string $user, + ?string $next = null, + ?string $previous = null, + ?int $limit = 25, + ?bool $ids = null, + string $contentType = self::contentTypes['getUserLikes'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getUserLikesWithHttpInfo($user, $next, $previous, $limit, $ids, $contentType); + return $response; + } + + /** + * Operation getUserLikesWithHttpInfo + * + * List liked scores + * + * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param bool|null $ids Return only the identifiers of the scores (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserLikes'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ScoreDetails[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getUserLikesWithHttpInfo( + string $user, + ?string $next = null, + ?string $previous = null, + ?int $limit = 25, + ?bool $ids = null, + string $contentType = self::contentTypes['getUserLikes'][0] + ): array + { + $request = $this->getUserLikesRequest($user, $next, $previous, $limit, $ids, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails[]', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ScoreDetails[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getUserLikesAsync + * + * List liked scores + * + * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param bool|null $ids Return only the identifiers of the scores (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserLikes'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getUserLikesAsync( + string $user, + ?string $next = null, + ?string $previous = null, + ?int $limit = 25, + ?bool $ids = null, + string $contentType = self::contentTypes['getUserLikes'][0] + ): PromiseInterface + { + return $this->getUserLikesAsyncWithHttpInfo($user, $next, $previous, $limit, $ids, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getUserLikesAsyncWithHttpInfo + * + * List liked scores + * + * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param bool|null $ids Return only the identifiers of the scores (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserLikes'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getUserLikesAsyncWithHttpInfo( + string $user, + ?string $next = null, + ?string $previous = null, + ?int $limit = 25, + ?bool $ids = null, + string $contentType = self::contentTypes['getUserLikes'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ScoreDetails[]'; + $request = $this->getUserLikesRequest($user, $next, $previous, $limit, $ids, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getUserLikes' + * + * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param bool|null $ids Return only the identifiers of the scores (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserLikes'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getUserLikesRequest( + string $user, + ?string $next = null, + ?string $previous = null, + ?int $limit = 25, + ?bool $ids = null, + string $contentType = self::contentTypes['getUserLikes'][0] + ): Request + { + // verify the required parameter 'user' is set + if ($user === null || (is_array($user) && count($user) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $user when calling getUserLikes' + ); + } + if ($limit !== null && $limit > 100) { + throw new InvalidArgumentException('invalid value for "$limit" when calling ScoreApi.getUserLikes, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new InvalidArgumentException('invalid value for "$limit" when calling ScoreApi.getUserLikes, must be bigger than or equal to 1.'); + } + + $resourcePath = '/users/{user}/likes'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $next, + 'next', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $previous, + 'previous', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $ids, + 'ids', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($user !== null) { + $resourcePath = str_replace( + '{user}', + ObjectSerializer::toPathValue($user), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getUserScores + * + * List user's scores + * + * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + * @param bool|null $paginate When set to `true`, the API will return a paginated result. When set to `false` or unset, the API will return all the scores. If this parameter is unset or false, then limit/sort/direction/next/previous will be ignored. (optional, default to false) + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserScores'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ScoreDetails[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getUserScores( + string $user, + ?bool $paginate = false, + ?string $sort = null, + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['getUserScores'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getUserScoresWithHttpInfo($user, $paginate, $sort, $direction, $limit, $next, $previous, $contentType); + return $response; + } + + /** + * Operation getUserScoresWithHttpInfo + * + * List user's scores + * + * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + * @param bool|null $paginate When set to `true`, the API will return a paginated result. When set to `false` or unset, the API will return all the scores. If this parameter is unset or false, then limit/sort/direction/next/previous will be ignored. (optional, default to false) + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserScores'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ScoreDetails[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getUserScoresWithHttpInfo( + string $user, + ?bool $paginate = false, + ?string $sort = null, + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['getUserScores'][0] + ): array + { + $request = $this->getUserScoresRequest($user, $paginate, $sort, $direction, $limit, $next, $previous, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails[]', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ScoreDetails[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getUserScoresAsync + * + * List user's scores + * + * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + * @param bool|null $paginate When set to `true`, the API will return a paginated result. When set to `false` or unset, the API will return all the scores. If this parameter is unset or false, then limit/sort/direction/next/previous will be ignored. (optional, default to false) + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserScores'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getUserScoresAsync( + string $user, + ?bool $paginate = false, + ?string $sort = null, + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['getUserScores'][0] + ): PromiseInterface + { + return $this->getUserScoresAsyncWithHttpInfo($user, $paginate, $sort, $direction, $limit, $next, $previous, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getUserScoresAsyncWithHttpInfo + * + * List user's scores + * + * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + * @param bool|null $paginate When set to `true`, the API will return a paginated result. When set to `false` or unset, the API will return all the scores. If this parameter is unset or false, then limit/sort/direction/next/previous will be ignored. (optional, default to false) + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserScores'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getUserScoresAsyncWithHttpInfo( + string $user, + ?bool $paginate = false, + ?string $sort = null, + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['getUserScores'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ScoreDetails[]'; + $request = $this->getUserScoresRequest($user, $paginate, $sort, $direction, $limit, $next, $previous, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getUserScores' + * + * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + * @param bool|null $paginate When set to `true`, the API will return a paginated result. When set to `false` or unset, the API will return all the scores. If this parameter is unset or false, then limit/sort/direction/next/previous will be ignored. (optional, default to false) + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserScores'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getUserScoresRequest( + string $user, + ?bool $paginate = false, + ?string $sort = null, + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['getUserScores'][0] + ): Request + { + // verify the required parameter 'user' is set + if ($user === null || (is_array($user) && count($user) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $user when calling getUserScores' + ); + } + if ($limit !== null && $limit > 100) { + throw new InvalidArgumentException('invalid value for "$limit" when calling ScoreApi.getUserScores, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new InvalidArgumentException('invalid value for "$limit" when calling ScoreApi.getUserScores, must be bigger than or equal to 1.'); + } + + $resourcePath = '/users/{user}/scores'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $paginate, + 'paginate', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $direction, + 'direction', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $next, + 'next', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $previous, + 'previous', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($user !== null) { + $resourcePath = str_replace( + '{user}', + ObjectSerializer::toPathValue($user), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listScoreTracks + * + * List the audio or video tracks linked to a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string|null $assignment An assignment id with which all the tracks returned will be related to (optional) + * @param bool|null $list_auto_track If true, and if available, return last automatically synchronized Flat's mp3 export as an additional track (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listScoreTracks'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ScoreTrack[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function listScoreTracks( + string $score, + ?string $sharing_key = null, + ?string $assignment = null, + ?bool $list_auto_track = null, + string $contentType = self::contentTypes['listScoreTracks'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->listScoreTracksWithHttpInfo($score, $sharing_key, $assignment, $list_auto_track, $contentType); + return $response; + } + + /** + * Operation listScoreTracksWithHttpInfo + * + * List the audio or video tracks linked to a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string|null $assignment An assignment id with which all the tracks returned will be related to (optional) + * @param bool|null $list_auto_track If true, and if available, return last automatically synchronized Flat's mp3 export as an additional track (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listScoreTracks'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ScoreTrack[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listScoreTracksWithHttpInfo( + string $score, + ?string $sharing_key = null, + ?string $assignment = null, + ?bool $list_auto_track = null, + string $contentType = self::contentTypes['listScoreTracks'][0] + ): array + { + $request = $this->listScoreTracksRequest($score, $sharing_key, $assignment, $list_auto_track, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreTrack[]', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreTrack[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ScoreTrack[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listScoreTracksAsync + * + * List the audio or video tracks linked to a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string|null $assignment An assignment id with which all the tracks returned will be related to (optional) + * @param bool|null $list_auto_track If true, and if available, return last automatically synchronized Flat's mp3 export as an additional track (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listScoreTracks'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listScoreTracksAsync( + string $score, + ?string $sharing_key = null, + ?string $assignment = null, + ?bool $list_auto_track = null, + string $contentType = self::contentTypes['listScoreTracks'][0] + ): PromiseInterface + { + return $this->listScoreTracksAsyncWithHttpInfo($score, $sharing_key, $assignment, $list_auto_track, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listScoreTracksAsyncWithHttpInfo + * + * List the audio or video tracks linked to a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string|null $assignment An assignment id with which all the tracks returned will be related to (optional) + * @param bool|null $list_auto_track If true, and if available, return last automatically synchronized Flat's mp3 export as an additional track (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listScoreTracks'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listScoreTracksAsyncWithHttpInfo( + string $score, + ?string $sharing_key = null, + ?string $assignment = null, + ?bool $list_auto_track = null, + string $contentType = self::contentTypes['listScoreTracks'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ScoreTrack[]'; + $request = $this->listScoreTracksRequest($score, $sharing_key, $assignment, $list_auto_track, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listScoreTracks' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string|null $assignment An assignment id with which all the tracks returned will be related to (optional) + * @param bool|null $list_auto_track If true, and if available, return last automatically synchronized Flat's mp3 export as an additional track (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listScoreTracks'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listScoreTracksRequest( + string $score, + ?string $sharing_key = null, + ?string $assignment = null, + ?bool $list_auto_track = null, + string $contentType = self::contentTypes['listScoreTracks'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling listScoreTracks' + ); + } + + $resourcePath = '/scores/{score}/tracks'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sharing_key, + 'sharingKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $assignment, + 'assignment', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $list_auto_track, + 'listAutoTrack', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation markScoreCommentResolved + * + * Mark the comment as resolved + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $comment Unique identifier of a sheet music comment (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markScoreCommentResolved'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\FlatErrorResponse|null + */ + public function markScoreCommentResolved( + string $score, + string $comment, + ?string $sharing_key = null, + string $contentType = self::contentTypes['markScoreCommentResolved'][0] + ): ?\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->markScoreCommentResolvedWithHttpInfo($score, $comment, $sharing_key, $contentType); + return $response; + } + + /** + * Operation markScoreCommentResolvedWithHttpInfo + * + * Mark the comment as resolved + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $comment Unique identifier of a sheet music comment (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markScoreCommentResolved'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function markScoreCommentResolvedWithHttpInfo( + string $score, + string $comment, + ?string $sharing_key = null, + string $contentType = self::contentTypes['markScoreCommentResolved'][0] + ): array + { + $request = $this->markScoreCommentResolvedRequest($score, $comment, $sharing_key, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation markScoreCommentResolvedAsync + * + * Mark the comment as resolved + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $comment Unique identifier of a sheet music comment (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markScoreCommentResolved'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function markScoreCommentResolvedAsync( + string $score, + string $comment, + ?string $sharing_key = null, + string $contentType = self::contentTypes['markScoreCommentResolved'][0] + ): PromiseInterface + { + return $this->markScoreCommentResolvedAsyncWithHttpInfo($score, $comment, $sharing_key, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation markScoreCommentResolvedAsyncWithHttpInfo + * + * Mark the comment as resolved + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $comment Unique identifier of a sheet music comment (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markScoreCommentResolved'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function markScoreCommentResolvedAsyncWithHttpInfo( + string $score, + string $comment, + ?string $sharing_key = null, + string $contentType = self::contentTypes['markScoreCommentResolved'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->markScoreCommentResolvedRequest($score, $comment, $sharing_key, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'markScoreCommentResolved' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $comment Unique identifier of a sheet music comment (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markScoreCommentResolved'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function markScoreCommentResolvedRequest( + string $score, + string $comment, + ?string $sharing_key = null, + string $contentType = self::contentTypes['markScoreCommentResolved'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling markScoreCommentResolved' + ); + } + // verify the required parameter 'comment' is set + if ($comment === null || (is_array($comment) && count($comment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $comment when calling markScoreCommentResolved' + ); + } + + $resourcePath = '/scores/{score}/comments/{comment}/resolved'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sharing_key, + 'sharingKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + // path params + if ($comment !== null) { + $resourcePath = str_replace( + '{comment}', + ObjectSerializer::toPathValue($comment), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation markScoreCommentUnresolved + * + * Mark the comment as unresolved + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $comment Unique identifier of a sheet music comment (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markScoreCommentUnresolved'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\FlatErrorResponse|null + */ + public function markScoreCommentUnresolved( + string $score, + string $comment, + ?string $sharing_key = null, + string $contentType = self::contentTypes['markScoreCommentUnresolved'][0] + ): ?\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->markScoreCommentUnresolvedWithHttpInfo($score, $comment, $sharing_key, $contentType); + return $response; + } + + /** + * Operation markScoreCommentUnresolvedWithHttpInfo + * + * Mark the comment as unresolved + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $comment Unique identifier of a sheet music comment (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markScoreCommentUnresolved'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function markScoreCommentUnresolvedWithHttpInfo( + string $score, + string $comment, + ?string $sharing_key = null, + string $contentType = self::contentTypes['markScoreCommentUnresolved'][0] + ): array + { + $request = $this->markScoreCommentUnresolvedRequest($score, $comment, $sharing_key, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation markScoreCommentUnresolvedAsync + * + * Mark the comment as unresolved + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $comment Unique identifier of a sheet music comment (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markScoreCommentUnresolved'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function markScoreCommentUnresolvedAsync( + string $score, + string $comment, + ?string $sharing_key = null, + string $contentType = self::contentTypes['markScoreCommentUnresolved'][0] + ): PromiseInterface + { + return $this->markScoreCommentUnresolvedAsyncWithHttpInfo($score, $comment, $sharing_key, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation markScoreCommentUnresolvedAsyncWithHttpInfo + * + * Mark the comment as unresolved + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $comment Unique identifier of a sheet music comment (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markScoreCommentUnresolved'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function markScoreCommentUnresolvedAsyncWithHttpInfo( + string $score, + string $comment, + ?string $sharing_key = null, + string $contentType = self::contentTypes['markScoreCommentUnresolved'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->markScoreCommentUnresolvedRequest($score, $comment, $sharing_key, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'markScoreCommentUnresolved' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $comment Unique identifier of a sheet music comment (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markScoreCommentUnresolved'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function markScoreCommentUnresolvedRequest( + string $score, + string $comment, + ?string $sharing_key = null, + string $contentType = self::contentTypes['markScoreCommentUnresolved'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling markScoreCommentUnresolved' + ); + } + // verify the required parameter 'comment' is set + if ($comment === null || (is_array($comment) && count($comment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $comment when calling markScoreCommentUnresolved' + ); + } + + $resourcePath = '/scores/{score}/comments/{comment}/resolved'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sharing_key, + 'sharingKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + // path params + if ($comment !== null) { + $resourcePath = str_replace( + '{comment}', + ObjectSerializer::toPathValue($comment), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation postScoreComment + * + * Post a new comment + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreCommentCreation $body body (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postScoreComment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ScoreComment|\Flat\APIClient\Model\FlatErrorResponse + */ + public function postScoreComment( + string $score, + \Flat\APIClient\Model\ScoreCommentCreation $body, + ?string $sharing_key = null, + string $contentType = self::contentTypes['postScoreComment'][0] + ): \Flat\APIClient\Model\ScoreComment|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->postScoreCommentWithHttpInfo($score, $body, $sharing_key, $contentType); + return $response; + } + + /** + * Operation postScoreCommentWithHttpInfo + * + * Post a new comment + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreCommentCreation $body (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postScoreComment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ScoreComment|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function postScoreCommentWithHttpInfo( + string $score, + \Flat\APIClient\Model\ScoreCommentCreation $body, + ?string $sharing_key = null, + string $contentType = self::contentTypes['postScoreComment'][0] + ): array + { + $request = $this->postScoreCommentRequest($score, $body, $sharing_key, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreComment', + $request, + $response, + ); + case 402: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreComment', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ScoreComment', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation postScoreCommentAsync + * + * Post a new comment + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreCommentCreation $body (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postScoreComment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function postScoreCommentAsync( + string $score, + \Flat\APIClient\Model\ScoreCommentCreation $body, + ?string $sharing_key = null, + string $contentType = self::contentTypes['postScoreComment'][0] + ): PromiseInterface + { + return $this->postScoreCommentAsyncWithHttpInfo($score, $body, $sharing_key, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation postScoreCommentAsyncWithHttpInfo + * + * Post a new comment + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreCommentCreation $body (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postScoreComment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function postScoreCommentAsyncWithHttpInfo( + string $score, + \Flat\APIClient\Model\ScoreCommentCreation $body, + ?string $sharing_key = null, + string $contentType = self::contentTypes['postScoreComment'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ScoreComment'; + $request = $this->postScoreCommentRequest($score, $body, $sharing_key, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'postScoreComment' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param \Flat\APIClient\Model\ScoreCommentCreation $body (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postScoreComment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function postScoreCommentRequest( + string $score, + \Flat\APIClient\Model\ScoreCommentCreation $body, + ?string $sharing_key = null, + string $contentType = self::contentTypes['postScoreComment'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling postScoreComment' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling postScoreComment' + ); + } + + $resourcePath = '/scores/{score}/comments'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sharing_key, + 'sharingKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation removeScoreCollaborator + * + * Delete a collaborator + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $collaborator Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) + * @param string|null $event_properties Optional analytics properties merged into XP tracking for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeScoreCollaborator'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\FlatErrorResponse|null + */ + public function removeScoreCollaborator( + string $score, + string $collaborator, + ?string $event_properties = null, + string $contentType = self::contentTypes['removeScoreCollaborator'][0] + ): ?\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->removeScoreCollaboratorWithHttpInfo($score, $collaborator, $event_properties, $contentType); + return $response; + } + + /** + * Operation removeScoreCollaboratorWithHttpInfo + * + * Delete a collaborator + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $collaborator Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) + * @param string|null $event_properties Optional analytics properties merged into XP tracking for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeScoreCollaborator'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function removeScoreCollaboratorWithHttpInfo( + string $score, + string $collaborator, + ?string $event_properties = null, + string $contentType = self::contentTypes['removeScoreCollaborator'][0] + ): array + { + $request = $this->removeScoreCollaboratorRequest($score, $collaborator, $event_properties, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation removeScoreCollaboratorAsync + * + * Delete a collaborator + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $collaborator Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) + * @param string|null $event_properties Optional analytics properties merged into XP tracking for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeScoreCollaborator'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function removeScoreCollaboratorAsync( + string $score, + string $collaborator, + ?string $event_properties = null, + string $contentType = self::contentTypes['removeScoreCollaborator'][0] + ): PromiseInterface + { + return $this->removeScoreCollaboratorAsyncWithHttpInfo($score, $collaborator, $event_properties, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation removeScoreCollaboratorAsyncWithHttpInfo + * + * Delete a collaborator + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $collaborator Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) + * @param string|null $event_properties Optional analytics properties merged into XP tracking for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeScoreCollaborator'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function removeScoreCollaboratorAsyncWithHttpInfo( + string $score, + string $collaborator, + ?string $event_properties = null, + string $contentType = self::contentTypes['removeScoreCollaborator'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->removeScoreCollaboratorRequest($score, $collaborator, $event_properties, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'removeScoreCollaborator' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $collaborator Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) + * @param string|null $event_properties Optional analytics properties merged into XP tracking for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeScoreCollaborator'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function removeScoreCollaboratorRequest( + string $score, + string $collaborator, + ?string $event_properties = null, + string $contentType = self::contentTypes['removeScoreCollaborator'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling removeScoreCollaborator' + ); + } + // verify the required parameter 'collaborator' is set + if ($collaborator === null || (is_array($collaborator) && count($collaborator) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $collaborator when calling removeScoreCollaborator' + ); + } + + $resourcePath = '/scores/{score}/collaborators/{collaborator}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $event_properties, + 'eventProperties', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + // path params + if ($collaborator !== null) { + $resourcePath = str_replace( + '{collaborator}', + ObjectSerializer::toPathValue($collaborator), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation untrashScore + * + * Untrash a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['untrashScore'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\FlatErrorResponse|null + */ + public function untrashScore( + string $score, + string $contentType = self::contentTypes['untrashScore'][0] + ): ?\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->untrashScoreWithHttpInfo($score, $contentType); + return $response; + } + + /** + * Operation untrashScoreWithHttpInfo + * + * Untrash a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['untrashScore'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function untrashScoreWithHttpInfo( + string $score, + string $contentType = self::contentTypes['untrashScore'][0] + ): array + { + $request = $this->untrashScoreRequest($score, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation untrashScoreAsync + * + * Untrash a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['untrashScore'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function untrashScoreAsync( + string $score, + string $contentType = self::contentTypes['untrashScore'][0] + ): PromiseInterface + { + return $this->untrashScoreAsyncWithHttpInfo($score, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation untrashScoreAsyncWithHttpInfo + * + * Untrash a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['untrashScore'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function untrashScoreAsyncWithHttpInfo( + string $score, + string $contentType = self::contentTypes['untrashScore'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->untrashScoreRequest($score, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'untrashScore' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['untrashScore'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function untrashScoreRequest( + string $score, + string $contentType = self::contentTypes['untrashScore'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling untrashScore' + ); + } + + $resourcePath = '/scores/{score}/untrash'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateScoreComment + * + * Update an existing comment + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $comment Unique identifier of a sheet music comment (required) + * @param \Flat\APIClient\Model\ScoreCommentUpdate $body body (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateScoreComment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ScoreComment|\Flat\APIClient\Model\FlatErrorResponse + */ + public function updateScoreComment( + string $score, + string $comment, + \Flat\APIClient\Model\ScoreCommentUpdate $body, + ?string $sharing_key = null, + string $contentType = self::contentTypes['updateScoreComment'][0] + ): \Flat\APIClient\Model\ScoreComment|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->updateScoreCommentWithHttpInfo($score, $comment, $body, $sharing_key, $contentType); + return $response; + } + + /** + * Operation updateScoreCommentWithHttpInfo + * + * Update an existing comment + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $comment Unique identifier of a sheet music comment (required) + * @param \Flat\APIClient\Model\ScoreCommentUpdate $body (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateScoreComment'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ScoreComment|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function updateScoreCommentWithHttpInfo( + string $score, + string $comment, + \Flat\APIClient\Model\ScoreCommentUpdate $body, + ?string $sharing_key = null, + string $contentType = self::contentTypes['updateScoreComment'][0] + ): array + { + $request = $this->updateScoreCommentRequest($score, $comment, $body, $sharing_key, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreComment', + $request, + $response, + ); + case 402: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreComment', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ScoreComment', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation updateScoreCommentAsync + * + * Update an existing comment + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $comment Unique identifier of a sheet music comment (required) + * @param \Flat\APIClient\Model\ScoreCommentUpdate $body (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateScoreComment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateScoreCommentAsync( + string $score, + string $comment, + \Flat\APIClient\Model\ScoreCommentUpdate $body, + ?string $sharing_key = null, + string $contentType = self::contentTypes['updateScoreComment'][0] + ): PromiseInterface + { + return $this->updateScoreCommentAsyncWithHttpInfo($score, $comment, $body, $sharing_key, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateScoreCommentAsyncWithHttpInfo + * + * Update an existing comment + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $comment Unique identifier of a sheet music comment (required) + * @param \Flat\APIClient\Model\ScoreCommentUpdate $body (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateScoreComment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateScoreCommentAsyncWithHttpInfo( + string $score, + string $comment, + \Flat\APIClient\Model\ScoreCommentUpdate $body, + ?string $sharing_key = null, + string $contentType = self::contentTypes['updateScoreComment'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ScoreComment'; + $request = $this->updateScoreCommentRequest($score, $comment, $body, $sharing_key, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateScoreComment' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $comment Unique identifier of a sheet music comment (required) + * @param \Flat\APIClient\Model\ScoreCommentUpdate $body (required) + * @param string|null $sharing_key This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateScoreComment'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateScoreCommentRequest( + string $score, + string $comment, + \Flat\APIClient\Model\ScoreCommentUpdate $body, + ?string $sharing_key = null, + string $contentType = self::contentTypes['updateScoreComment'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling updateScoreComment' + ); + } + // verify the required parameter 'comment' is set + if ($comment === null || (is_array($comment) && count($comment) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $comment when calling updateScoreComment' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling updateScoreComment' + ); + } + + $resourcePath = '/scores/{score}/comments/{comment}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sharing_key, + 'sharingKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + // path params + if ($comment !== null) { + $resourcePath = str_replace( + '{comment}', + ObjectSerializer::toPathValue($comment), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateScoreTrack + * + * Update an audio or video track linked to a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $track Unique identifier of a score audio track (required) + * @param \Flat\APIClient\Model\ScoreTrackUpdate $body body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateScoreTrack'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ScoreTrack|\Flat\APIClient\Model\FlatErrorResponse + */ + public function updateScoreTrack( + string $score, + string $track, + \Flat\APIClient\Model\ScoreTrackUpdate $body, + string $contentType = self::contentTypes['updateScoreTrack'][0] + ): \Flat\APIClient\Model\ScoreTrack|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->updateScoreTrackWithHttpInfo($score, $track, $body, $contentType); + return $response; + } + + /** + * Operation updateScoreTrackWithHttpInfo + * + * Update an audio or video track linked to a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $track Unique identifier of a score audio track (required) + * @param \Flat\APIClient\Model\ScoreTrackUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateScoreTrack'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ScoreTrack|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function updateScoreTrackWithHttpInfo( + string $score, + string $track, + \Flat\APIClient\Model\ScoreTrackUpdate $body, + string $contentType = self::contentTypes['updateScoreTrack'][0] + ): array + { + $request = $this->updateScoreTrackRequest($score, $track, $body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreTrack', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreTrack', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ScoreTrack', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation updateScoreTrackAsync + * + * Update an audio or video track linked to a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $track Unique identifier of a score audio track (required) + * @param \Flat\APIClient\Model\ScoreTrackUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateScoreTrack'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateScoreTrackAsync( + string $score, + string $track, + \Flat\APIClient\Model\ScoreTrackUpdate $body, + string $contentType = self::contentTypes['updateScoreTrack'][0] + ): PromiseInterface + { + return $this->updateScoreTrackAsyncWithHttpInfo($score, $track, $body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateScoreTrackAsyncWithHttpInfo + * + * Update an audio or video track linked to a score + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $track Unique identifier of a score audio track (required) + * @param \Flat\APIClient\Model\ScoreTrackUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateScoreTrack'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateScoreTrackAsyncWithHttpInfo( + string $score, + string $track, + \Flat\APIClient\Model\ScoreTrackUpdate $body, + string $contentType = self::contentTypes['updateScoreTrack'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ScoreTrack'; + $request = $this->updateScoreTrackRequest($score, $track, $body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateScoreTrack' + * + * @param string $score Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + * @param string $track Unique identifier of a score audio track (required) + * @param \Flat\APIClient\Model\ScoreTrackUpdate $body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateScoreTrack'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateScoreTrackRequest( + string $score, + string $track, + \Flat\APIClient\Model\ScoreTrackUpdate $body, + string $contentType = self::contentTypes['updateScoreTrack'][0] + ): Request + { + // verify the required parameter 'score' is set + if ($score === null || (is_array($score) && count($score) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $score when calling updateScoreTrack' + ); + } + // verify the required parameter 'track' is set + if ($track === null || (is_array($track) && count($track) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $track when calling updateScoreTrack' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling updateScoreTrack' + ); + } + + $resourcePath = '/scores/{score}/tracks/{track}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($score !== null) { + $resourcePath = str_replace( + '{score}', + ObjectSerializer::toPathValue($score), + $resourcePath + ); + } + // path params + if ($track !== null) { + $resourcePath = str_replace( + '{track}', + ObjectSerializer::toPathValue($track), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/src/Api/TaskApi.php b/src/Api/TaskApi.php new file mode 100644 index 0000000..27b16b1 --- /dev/null +++ b/src/Api/TaskApi.php @@ -0,0 +1,458 @@ + $contentTypes **/ + public const contentTypes = [ + 'getTask' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation getTask + * + * Get a task details + * + * @param string $task Unique identifier for the task (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTask'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\Task|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getTask( + string $task, + string $contentType = self::contentTypes['getTask'][0] + ): \Flat\APIClient\Model\Task|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getTaskWithHttpInfo($task, $contentType); + return $response; + } + + /** + * Operation getTaskWithHttpInfo + * + * Get a task details + * + * @param string $task Unique identifier for the task (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTask'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\Task|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getTaskWithHttpInfo( + string $task, + string $contentType = self::contentTypes['getTask'][0] + ): array + { + $request = $this->getTaskRequest($task, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Task', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\Task', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\Task', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getTaskAsync + * + * Get a task details + * + * @param string $task Unique identifier for the task (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTask'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getTaskAsync( + string $task, + string $contentType = self::contentTypes['getTask'][0] + ): PromiseInterface + { + return $this->getTaskAsyncWithHttpInfo($task, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTaskAsyncWithHttpInfo + * + * Get a task details + * + * @param string $task Unique identifier for the task (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTask'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getTaskAsyncWithHttpInfo( + string $task, + string $contentType = self::contentTypes['getTask'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\Task'; + $request = $this->getTaskRequest($task, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getTask' + * + * @param string $task Unique identifier for the task (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTask'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getTaskRequest( + string $task, + string $contentType = self::contentTypes['getTask'][0] + ): Request + { + // verify the required parameter 'task' is set + if ($task === null || (is_array($task) && count($task) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $task when calling getTask' + ); + } + + $resourcePath = '/tasks/{task}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($task !== null) { + $resourcePath = str_replace( + '{task}', + ObjectSerializer::toPathValue($task), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/src/Api/UserApi.php b/src/Api/UserApi.php new file mode 100644 index 0000000..88a8412 --- /dev/null +++ b/src/Api/UserApi.php @@ -0,0 +1,1206 @@ + $contentTypes **/ + public const contentTypes = [ + 'getUser' => [ + 'application/json', + ], + 'getUserLikes' => [ + 'application/json', + ], + 'getUserScores' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation getUser + * + * Get a public user profile + * + * @param string $user This route parameter is the unique identifier of the user. You can specify an email instead of an unique identifier. If you are executing this request authenticated, you can use `me` as a value instead of the current User unique identifier to work on the current authenticated user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUser'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\UserPublic|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getUser( + string $user, + string $contentType = self::contentTypes['getUser'][0] + ): \Flat\APIClient\Model\UserPublic|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getUserWithHttpInfo($user, $contentType); + return $response; + } + + /** + * Operation getUserWithHttpInfo + * + * Get a public user profile + * + * @param string $user This route parameter is the unique identifier of the user. You can specify an email instead of an unique identifier. If you are executing this request authenticated, you can use `me` as a value instead of the current User unique identifier to work on the current authenticated user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUser'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\UserPublic|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getUserWithHttpInfo( + string $user, + string $contentType = self::contentTypes['getUser'][0] + ): array + { + $request = $this->getUserRequest($user, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\UserPublic', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\UserPublic', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\UserPublic', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getUserAsync + * + * Get a public user profile + * + * @param string $user This route parameter is the unique identifier of the user. You can specify an email instead of an unique identifier. If you are executing this request authenticated, you can use `me` as a value instead of the current User unique identifier to work on the current authenticated user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getUserAsync( + string $user, + string $contentType = self::contentTypes['getUser'][0] + ): PromiseInterface + { + return $this->getUserAsyncWithHttpInfo($user, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getUserAsyncWithHttpInfo + * + * Get a public user profile + * + * @param string $user This route parameter is the unique identifier of the user. You can specify an email instead of an unique identifier. If you are executing this request authenticated, you can use `me` as a value instead of the current User unique identifier to work on the current authenticated user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getUserAsyncWithHttpInfo( + string $user, + string $contentType = self::contentTypes['getUser'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\UserPublic'; + $request = $this->getUserRequest($user, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getUser' + * + * @param string $user This route parameter is the unique identifier of the user. You can specify an email instead of an unique identifier. If you are executing this request authenticated, you can use `me` as a value instead of the current User unique identifier to work on the current authenticated user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUser'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getUserRequest( + string $user, + string $contentType = self::contentTypes['getUser'][0] + ): Request + { + // verify the required parameter 'user' is set + if ($user === null || (is_array($user) && count($user) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $user when calling getUser' + ); + } + + $resourcePath = '/users/{user}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($user !== null) { + $resourcePath = str_replace( + '{user}', + ObjectSerializer::toPathValue($user), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getUserLikes + * + * List liked scores + * + * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param bool|null $ids Return only the identifiers of the scores (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserLikes'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ScoreDetails[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getUserLikes( + string $user, + ?string $next = null, + ?string $previous = null, + ?int $limit = 25, + ?bool $ids = null, + string $contentType = self::contentTypes['getUserLikes'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getUserLikesWithHttpInfo($user, $next, $previous, $limit, $ids, $contentType); + return $response; + } + + /** + * Operation getUserLikesWithHttpInfo + * + * List liked scores + * + * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param bool|null $ids Return only the identifiers of the scores (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserLikes'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ScoreDetails[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getUserLikesWithHttpInfo( + string $user, + ?string $next = null, + ?string $previous = null, + ?int $limit = 25, + ?bool $ids = null, + string $contentType = self::contentTypes['getUserLikes'][0] + ): array + { + $request = $this->getUserLikesRequest($user, $next, $previous, $limit, $ids, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails[]', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ScoreDetails[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getUserLikesAsync + * + * List liked scores + * + * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param bool|null $ids Return only the identifiers of the scores (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserLikes'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getUserLikesAsync( + string $user, + ?string $next = null, + ?string $previous = null, + ?int $limit = 25, + ?bool $ids = null, + string $contentType = self::contentTypes['getUserLikes'][0] + ): PromiseInterface + { + return $this->getUserLikesAsyncWithHttpInfo($user, $next, $previous, $limit, $ids, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getUserLikesAsyncWithHttpInfo + * + * List liked scores + * + * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param bool|null $ids Return only the identifiers of the scores (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserLikes'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getUserLikesAsyncWithHttpInfo( + string $user, + ?string $next = null, + ?string $previous = null, + ?int $limit = 25, + ?bool $ids = null, + string $contentType = self::contentTypes['getUserLikes'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ScoreDetails[]'; + $request = $this->getUserLikesRequest($user, $next, $previous, $limit, $ids, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getUserLikes' + * + * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param bool|null $ids Return only the identifiers of the scores (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserLikes'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getUserLikesRequest( + string $user, + ?string $next = null, + ?string $previous = null, + ?int $limit = 25, + ?bool $ids = null, + string $contentType = self::contentTypes['getUserLikes'][0] + ): Request + { + // verify the required parameter 'user' is set + if ($user === null || (is_array($user) && count($user) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $user when calling getUserLikes' + ); + } + if ($limit !== null && $limit > 100) { + throw new InvalidArgumentException('invalid value for "$limit" when calling UserApi.getUserLikes, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new InvalidArgumentException('invalid value for "$limit" when calling UserApi.getUserLikes, must be bigger than or equal to 1.'); + } + + $resourcePath = '/users/{user}/likes'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $next, + 'next', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $previous, + 'previous', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $ids, + 'ids', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($user !== null) { + $resourcePath = str_replace( + '{user}', + ObjectSerializer::toPathValue($user), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getUserScores + * + * List user's scores + * + * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + * @param bool|null $paginate When set to `true`, the API will return a paginated result. When set to `false` or unset, the API will return all the scores. If this parameter is unset or false, then limit/sort/direction/next/previous will be ignored. (optional, default to false) + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserScores'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Flat\APIClient\Model\ScoreDetails[]|\Flat\APIClient\Model\FlatErrorResponse + */ + public function getUserScores( + string $user, + ?bool $paginate = false, + ?string $sort = null, + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['getUserScores'][0] + ): array|\Flat\APIClient\Model\FlatErrorResponse + { + list($response) = $this->getUserScoresWithHttpInfo($user, $paginate, $sort, $direction, $limit, $next, $previous, $contentType); + return $response; + } + + /** + * Operation getUserScoresWithHttpInfo + * + * List user's scores + * + * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + * @param bool|null $paginate When set to `true`, the API will return a paginated result. When set to `false` or unset, the API will return all the scores. If this parameter is unset or false, then limit/sort/direction/next/previous will be ignored. (optional, default to false) + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserScores'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Flat\APIClient\Model\ScoreDetails[]|\Flat\APIClient\Model\FlatErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getUserScoresWithHttpInfo( + string $user, + ?bool $paginate = false, + ?string $sort = null, + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['getUserScores'][0] + ): array + { + $request = $this->getUserScoresRequest($user, $paginate, $sort, $direction, $limit, $next, $previous, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails[]', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\FlatErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Flat\APIClient\Model\ScoreDetails[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\ScoreDetails[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Flat\APIClient\Model\FlatErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getUserScoresAsync + * + * List user's scores + * + * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + * @param bool|null $paginate When set to `true`, the API will return a paginated result. When set to `false` or unset, the API will return all the scores. If this parameter is unset or false, then limit/sort/direction/next/previous will be ignored. (optional, default to false) + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserScores'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getUserScoresAsync( + string $user, + ?bool $paginate = false, + ?string $sort = null, + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['getUserScores'][0] + ): PromiseInterface + { + return $this->getUserScoresAsyncWithHttpInfo($user, $paginate, $sort, $direction, $limit, $next, $previous, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getUserScoresAsyncWithHttpInfo + * + * List user's scores + * + * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + * @param bool|null $paginate When set to `true`, the API will return a paginated result. When set to `false` or unset, the API will return all the scores. If this parameter is unset or false, then limit/sort/direction/next/previous will be ignored. (optional, default to false) + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserScores'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getUserScoresAsyncWithHttpInfo( + string $user, + ?bool $paginate = false, + ?string $sort = null, + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['getUserScores'][0] + ): PromiseInterface + { + $returnType = '\Flat\APIClient\Model\ScoreDetails[]'; + $request = $this->getUserScoresRequest($user, $paginate, $sort, $direction, $limit, $next, $previous, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getUserScores' + * + * @param string $user Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + * @param bool|null $paginate When set to `true`, the API will return a paginated result. When set to `false` or unset, the API will return all the scores. If this parameter is unset or false, then limit/sort/direction/next/previous will be ignored. (optional, default to false) + * @param string|null $sort Sort (optional) + * @param string|null $direction Sort direction (optional) + * @param int|null $limit This is the maximum number of objects that may be returned (optional, default to 25) + * @param string|null $next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string|null $previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserScores'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getUserScoresRequest( + string $user, + ?bool $paginate = false, + ?string $sort = null, + ?string $direction = null, + ?int $limit = 25, + ?string $next = null, + ?string $previous = null, + string $contentType = self::contentTypes['getUserScores'][0] + ): Request + { + // verify the required parameter 'user' is set + if ($user === null || (is_array($user) && count($user) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $user when calling getUserScores' + ); + } + if ($limit !== null && $limit > 100) { + throw new InvalidArgumentException('invalid value for "$limit" when calling UserApi.getUserScores, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new InvalidArgumentException('invalid value for "$limit" when calling UserApi.getUserScores, must be bigger than or equal to 1.'); + } + + $resourcePath = '/users/{user}/scores'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $paginate, + 'paginate', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $direction, + 'direction', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $next, + 'next', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $previous, + 'previous', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($user !== null) { + $resourcePath = str_replace( + '{user}', + ObjectSerializer::toPathValue($user), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/src/ApiException.php b/src/ApiException.php new file mode 100644 index 0000000..7fc4c68 --- /dev/null +++ b/src/ApiException.php @@ -0,0 +1,119 @@ +responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; + } + + /** + * Gets the HTTP response header + * + * @return string[][]|null HTTP response header + */ + public function getResponseHeaders(): ?array + { + return $this->responseHeaders; + } + + /** + * Gets the HTTP body of the server response either as Json or string + * + * @return stdClass|string|null HTTP body of the server response either as \stdClass or string + */ + public function getResponseBody(): stdClass|string|null + { + return $this->responseBody; + } + + /** + * Sets the deserialized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject(mixed $obj): void + { + $this->responseObject = $obj; + } + + /** + * Gets the deserialized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject(): mixed + { + return $this->responseObject; + } +} diff --git a/src/Configuration.php b/src/Configuration.php new file mode 100644 index 0000000..17267d6 --- /dev/null +++ b/src/Configuration.php @@ -0,0 +1,528 @@ +tempFolderPath = sys_get_temp_dir(); + } + + /** + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey(string $apiKeyIdentifier, string $key): static + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string API key or token + */ + public function getApiKey(string $apiKeyIdentifier): ?string + { + return $this->apiKeys[$apiKeyIdentifier] ?? null; + } + + /** + * Sets the prefix for API key (e.g. Bearer) + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $prefix API key prefix, e.g. Bearer + * + * @return $this + */ + public function setApiKeyPrefix(string $apiKeyIdentifier, string $prefix): static + { + $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; + return $this; + } + + /** + * Gets API key prefix + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string + */ + public function getApiKeyPrefix(string $apiKeyIdentifier): ?string + { + return $this->apiKeyPrefixes[$apiKeyIdentifier] ?? null; + } + + /** + * Sets the access token for OAuth + * + * @param string $accessToken Token for OAuth + * + * @return $this + */ + public function setAccessToken(string $accessToken): static + { + $this->accessToken = $accessToken; + return $this; + } + + /** + * Gets the access token for OAuth + * + * @return string Access token for OAuth + */ + public function getAccessToken(): string + { + return $this->accessToken; + } + + /** + * Sets boolean format for query string. + * + * @param string $booleanFormat Boolean format for query string + * + * @return $this + */ + public function setBooleanFormatForQueryString(string $booleanFormat): static + { + $this->booleanFormatForQueryString = $booleanFormat; + + return $this; + } + + /** + * Gets boolean format for query string. + * + * @return string Boolean format for query string + */ + public function getBooleanFormatForQueryString(): string + { + return $this->booleanFormatForQueryString; + } + + /** + * Sets the username for HTTP basic authentication + * + * @param string $username Username for HTTP basic authentication + * + * @return $this + */ + public function setUsername(string $username): static + { + $this->username = $username; + return $this; + } + + /** + * Gets the username for HTTP basic authentication + * + * @return string Username for HTTP basic authentication + */ + public function getUsername(): string + { + return $this->username; + } + + /** + * Sets the password for HTTP basic authentication + * + * @param string $password Password for HTTP basic authentication + * + * @return $this + */ + public function setPassword(string $password): static + { + $this->password = $password; + return $this; + } + + /** + * Gets the password for HTTP basic authentication + * + * @return string Password for HTTP basic authentication + */ + public function getPassword(): string + { + return $this->password; + } + + /** + * Sets the host + * + * @param string $host Host + * + * @return $this + */ + public function setHost(string $host): static + { + $this->host = $host; + return $this; + } + + /** + * Gets the host + * + * @return string Host + */ + public function getHost(): string + { + return $this->host; + } + + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws InvalidArgumentException + * @return $this + */ + public function setUserAgent(string $userAgent): static + { + $this->userAgent = $userAgent; + return $this; + } + + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent(): string + { + return $this->userAgent; + } + + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug(bool $debug): static + { + $this->debug = $debug; + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug(): bool + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile(string $debugFile): static + { + $this->debugFile = $debugFile; + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile(): string + { + return $this->debugFile; + } + + /** + * Sets the temp folder path + * + * @param string $tempFolderPath Temp folder path + * + * @return $this + */ + public function setTempFolderPath(string $tempFolderPath): static + { + $this->tempFolderPath = $tempFolderPath; + return $this; + } + + /** + * Gets the temp folder path + * + * @return string Temp folder path + */ + public function getTempFolderPath(): string + { + return $this->tempFolderPath; + } + + /** + * Gets the default configuration instance + * + * @return Configuration + */ + public static function getDefaultConfiguration(): Configuration + { + if (self::$defaultConfiguration === null) { + self::$defaultConfiguration = new Configuration(); + } + + return self::$defaultConfiguration; + } + + /** + * Sets the default configuration instance + * + * @param Configuration $config An instance of the Configuration Object + * + * @return void + */ + public static function setDefaultConfiguration(Configuration $config): void + { + self::$defaultConfiguration = $config; + } + + /** + * Gets the essential information for debugging + * + * @return string The report for debugging + */ + public static function toDebugReport(): string + { + $report = 'PHP SDK (Flat\APIClient) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' The version of the OpenAPI document: 2.26.1' . PHP_EOL; + $report .= ' SDK Package Version: 2.0.0' . PHP_EOL; + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; + + return $report; + } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return null|string API key with the prefix + */ + public function getApiKeyWithPrefix(string $apiKeyIdentifier): ?string + { + $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->getApiKey($apiKeyIdentifier); + + if ($apiKey === null) { + return null; + } + + if ($prefix === null) { + $keyWithPrefix = $apiKey; + } else { + $keyWithPrefix = $prefix . ' ' . $apiKey; + } + + return $keyWithPrefix; + } + + /** + * Returns an array of host settings + * + * @return array an array of host settings + */ + public function getHostSettings(): array + { + return [ + [ + "url" => "https://api.flat.io/v2", + "description" => "No description provided", + ] + ]; + } + + /** + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostSettings, int $hostIndex, ?array $variables = null): string + { + if (null === $variables) { + $variables = []; + } + + // check array index out of bound + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); + } + + $host = $hostSettings[$hostIndex]; + $url = $host["url"]; + + // go through variable and assign a value + foreach ($host["variables"] ?? [] as $name => $variable) { + if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + $url = str_replace("{".$name."}", $variables[$name], $url); + } else { + throw new InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); + } + } else { + // use default value + $url = str_replace("{".$name."}", $variable["default_value"], $url); + } + } + + return $url; + } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings(int $index, ?array $variables = null): string + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } +} diff --git a/src/Errors.php b/src/Errors.php new file mode 100644 index 0000000..79e2622 --- /dev/null +++ b/src/Errors.php @@ -0,0 +1,117 @@ + */ + public readonly array $headers = [], + public readonly mixed $body = null, + ) { + parent::__construct($message); + } + + public function __toString(): string + { + $parts = [$this->getMessage()]; + if ($this->errorCode !== null) { $parts[] = "code={$this->errorCode}"; } + if ($this->status !== null) { $parts[] = "status={$this->status}"; } + if ($this->requestId !== null) { $parts[] = "id={$this->requestId}"; } + + return implode(' ', $parts); + } +} + +/** The token is missing, invalid or expired, or a refresh failed. Re-authorize. */ +class FlatAuthenticationError extends FlatError {} +/** Authenticated but not permitted: a missing scope or insufficient permission. */ +class FlatAuthorizationError extends FlatError {} +/** The request body or parameters failed validation. */ +class FlatValidationError extends FlatError {} +/** The resource does not exist, or is not visible to this token. */ +class FlatNotFoundError extends FlatError {} +/** A metered resource, such as OMR credits, is exhausted. */ +class FlatQuotaError extends FlatError {} +/** An internal or backend error. `requestId` is normally set here. */ +class FlatServerError extends FlatError {} + +/** The account or IP exceeded its request quota. Returned as HTTP 403, not 429. */ +class FlatRateLimitError extends FlatError +{ + public readonly ?int $limit; + public readonly ?int $remaining; + /** UTC epoch seconds at which the window resets. Flat sends no Retry-After header. */ + public readonly ?int $reset; + + /** @param array $headers */ + public function __construct( + string $message, + ?int $status = null, + ?string $errorCode = null, + ?string $requestId = null, + array $headers = [], + mixed $body = null, + ) { + parent::__construct($message, $status, $errorCode, $requestId, $headers, $body); + $this->limit = self::intHeader($headers, 'x-ratelimit-limit'); + $this->remaining = self::intHeader($headers, 'x-ratelimit-remaining'); + $this->reset = self::intHeader($headers, 'x-ratelimit-reset'); + } + + /** @param array $headers */ + private static function intHeader(array $headers, string $name): ?int + { + foreach ($headers as $key => $value) { + if (strtolower((string) $key) === $name) { + return is_numeric($value) ? (int) $value : null; + } + } + + return null; + } +} + +final class ErrorFactory +{ + public const RATE_LIMIT_CODE = 'API_RATE_LIMIT_EXCEEDED'; + private const QUOTA_CODES = ['QUOTA_EXCEEDED', 'CREDITS_EXHAUSTED', 'OMR_CREDITS_EXHAUSTED']; + + /** @param array $headers */ + public static function fromResponse(int $status, mixed $body, array $headers = []): FlatError + { + $payload = is_array($body) ? $body : []; + $code = $payload['code'] ?? null; + $message = $payload['message'] ?? "HTTP {$status}"; + $id = $payload['id'] ?? null; + + if ($status === 403 && $code === self::RATE_LIMIT_CODE) { + return new FlatRateLimitError($message, $status, $code, $id, $headers, $body); + } + if ($code !== null && in_array($code, self::QUOTA_CODES, true)) { + return new FlatQuotaError($message, $status, $code, $id, $headers, $body); + } + + return match (true) { + $status === 401 => new FlatAuthenticationError($message, $status, $code, $id, $headers, $body), + $status === 403 => new FlatAuthorizationError($message, $status, $code, $id, $headers, $body), + $status === 404 => new FlatNotFoundError($message, $status, $code, $id, $headers, $body), + $status === 400, $status === 422 => new FlatValidationError($message, $status, $code, $id, $headers, $body), + $status >= 500 => new FlatServerError($message, $status, $code, $id, $headers, $body), + default => new FlatError($message, $status, $code, $id, $headers, $body), + }; + } +} diff --git a/src/FlatClient.php b/src/FlatClient.php new file mode 100644 index 0000000..2a60a24 --- /dev/null +++ b/src/FlatClient.php @@ -0,0 +1,245 @@ +account()->getAuthenticatedUser(); + * foreach ($client->paginate('listCollections', ['parent' => 'user']) as $collection) { ... } + * + * It owns one Guzzle client, so every API reached through it shares a connection, the retry + * policy and the typed errors. Constructing the generated Api classes directly still works, but + * they then carry a plain Guzzle client and raise the generator's own ApiException. + */ +final class FlatClient +{ + public const DEFAULT_BASE_URL = 'https://api.flat.io/v2'; + /** A finite default. Waiting forever is not an acceptable default for an SDK. */ + public const DEFAULT_TIMEOUT_SECONDS = 30.0; + + private const APIS = [ + 'account' => Api\AccountApi::class, + 'classes' => Api\ClassApi::class, + 'collections' => Api\CollectionApi::class, + 'eduResources' => Api\EduResourcesApi::class, + 'groups' => Api\GroupApi::class, + 'omr' => Api\OMRApi::class, + 'organization' => Api\OrganizationApi::class, + 'scores' => Api\ScoreApi::class, + 'tasks' => Api\TaskApi::class, + 'users' => Api\UserApi::class, + ]; + + private Configuration $config; + private Client $http; + private RetryPolicy $retry; + /** @var array */ + private array $apis = []; + + public function __construct( + ?string $accessToken = null, + ?Configuration $config = null, + ?RetryPolicy $retry = null, + ?string $baseUrl = null, + float $timeout = self::DEFAULT_TIMEOUT_SECONDS, + ?HandlerStack $handler = null, + ) { + // A fresh Configuration, not getDefaultConfiguration(): a client built with its own token + // must not replace the token every other client is using. + $this->config = $config ?? new Configuration(); + if ($accessToken !== null) { + $this->config->setAccessToken($accessToken); + } + $this->config->setHost($baseUrl ?? self::DEFAULT_BASE_URL); + $this->retry = $retry ?? new RetryPolicy(); + + $stack = $handler ?? HandlerStack::create(); + $stack->push($this->typedErrors(), 'flat_typed_errors'); + $stack->push($this->retries(), 'flat_retries'); + + $this->http = new Client(['handler' => $stack, 'timeout' => $timeout, 'http_errors' => false]); + } + + public function configuration(): Configuration + { + return $this->config; + } + + public function retryPolicy(): RetryPolicy + { + return $this->retry; + } + + /** + * Convert a non-2xx response into the typed error, below every generated Api. + * + * http_errors is off on the Guzzle client, so Guzzle does not raise its own exception first. + * The typed error is not a RequestException, so the generated `catch (RequestException $e)` + * blocks do not swallow it and rewrap it as an ApiException: it reaches the caller intact. + */ + private function typedErrors(): callable + { + return static fn (callable $next): callable => + static function (RequestInterface $request, array $options) use ($next): PromiseInterface { + return $next($request, $options)->then( + static function (ResponseInterface $response) { + $status = $response->getStatusCode(); + if ($status >= 200 && $status < 300) { + return $response; + } + + $raw = (string) $response->getBody(); + // Rewound for the caller: a PSR-7 stream read to the end returns nothing + // on a second read, and the generated code may still look at it. + $response->getBody()->rewind(); + $body = json_decode($raw, true); + + $headers = []; + foreach ($response->getHeaders() as $name => $values) { + $headers[$name] = implode(', ', $values); + } + + // The typed error needs the body: Flat returns 403 both for rate limiting + // and for a genuine authorization failure, and only `code` separates them. + throw ErrorFactory::fromResponse($status, is_array($body) ? $body : $raw, $headers); + } + ); + }; + } + + /** Apply the retry policy to every request. */ + private function retries(): callable + { + $policy = $this->retry; + + return static fn (callable $next): callable => + static function (RequestInterface $request, array $options) use ($next, $policy): PromiseInterface { + $attempt = ($options['flat_attempt'] ?? 0) + 1; + $options['flat_attempt'] = $attempt; + + return $next($request, $options)->otherwise( + static function (\Throwable $error) use ($request, $options, $next, $policy, $attempt) { + if (!$policy->shouldRetry($error, $request->getMethod(), $attempt)) { + throw $error; + } + usleep((int) ($policy->delayFor($error, $attempt) * 1_000_000)); + return $next($request, $options); + } + ); + }; + } + + /** One generated API by short name, memoised. */ + public function api(string $name): object + { + $class = self::APIS[$name] ?? null; + if ($class === null) { + throw new \InvalidArgumentException( + sprintf('unknown API %s, expected one of: %s', $name, implode(', ', array_keys(self::APIS))) + ); + } + + return $this->apis[$name] ??= new $class($this->http, $this->config); + } + + /** The generated AccountApi, built on this client's HTTP stack. */ + public function account(): Api\AccountApi + { + return $this->api('account'); + } + + /** The generated ClassApi, built on this client's HTTP stack. */ + public function classes(): Api\ClassApi + { + return $this->api('classes'); + } + + /** The generated CollectionApi, built on this client's HTTP stack. */ + public function collections(): Api\CollectionApi + { + return $this->api('collections'); + } + + /** The generated EduResourcesApi, built on this client's HTTP stack. */ + public function eduResources(): Api\EduResourcesApi + { + return $this->api('eduResources'); + } + + /** The generated GroupApi, built on this client's HTTP stack. */ + public function groups(): Api\GroupApi + { + return $this->api('groups'); + } + + /** The generated OMRApi, built on this client's HTTP stack. */ + public function omr(): Api\OMRApi + { + return $this->api('omr'); + } + + /** The generated OrganizationApi, built on this client's HTTP stack. */ + public function organization(): Api\OrganizationApi + { + return $this->api('organization'); + } + + /** The generated ScoreApi, built on this client's HTTP stack. */ + public function scores(): Api\ScoreApi + { + return $this->api('scores'); + } + + /** The generated TaskApi, built on this client's HTTP stack. */ + public function tasks(): Api\TaskApi + { + return $this->api('tasks'); + } + + /** The generated UserApi, built on this client's HTTP stack. */ + public function users(): Api\UserApi + { + return $this->api('users'); + } + + /** + * Every item across every page of a cursor-paginated operation. + * + * foreach ($client->paginate('listCollections', ['parent' => 'user']) as $collection) { ... } + * + * The operation is named rather than passed, because the generated methods are instance + * methods. An operation that does not paginate yields its single page, so this is always safe. + */ + public function paginate(string $operation, array $params = []): \Generator + { + $method = $operation . 'WithHttpInfo'; + $owner = null; + foreach (array_keys(self::APIS) as $name) { + if (method_exists($this->api($name), $method)) { + $owner = $this->api($name); + break; + } + } + if ($owner === null) { + throw new \InvalidArgumentException(sprintf('no operation %s on any Flat API', $operation)); + } + + // Spread with string keys, which PHP 8 passes as named arguments. The generated methods + // take positional parameters in specification order, so spreading array_values would hand + // `limit` to `$sort` the moment a caller omits one. + return Pagination::paginate( + static fn (array $pageParams) => $owner->{$method}(...$pageParams), + $params, + ); + } +} diff --git a/src/FormDataProcessor.php b/src/FormDataProcessor.php new file mode 100644 index 0000000..d1594eb --- /dev/null +++ b/src/FormDataProcessor.php @@ -0,0 +1,241 @@ + $values the value of the form parameter + * + * @return array [key => value] of formdata + */ + public function prepare(array $values): array + { + $this->has_file = false; + $result = []; + + foreach ($values as $k => $v) { + if ($v === null) { + continue; + } + + $result[$k] = $this->makeFormSafe($v); + } + + return $result; + } + + /** + * Flattens a multi-level array of data and generates a single-level array + * compatible with formdata - a single-level array where the keys use bracket + * notation to signify nested data. + * + * credit: https://github.com/FranBar1966/FlatPHP + */ + public static function flatten(array $source, string $start = ''): array + { + $opt = [ + 'prefix' => '[', + 'suffix' => ']', + 'suffix-end' => true, + 'prefix-list' => '[', + 'suffix-list' => ']', + 'suffix-list-end' => true, + ]; + + if ($start === '') { + $currentPrefix = ''; + $currentSuffix = ''; + $currentSuffixEnd = false; + } elseif (array_is_list($source)) { + $currentPrefix = $opt['prefix-list']; + $currentSuffix = $opt['suffix-list']; + $currentSuffixEnd = $opt['suffix-list-end']; + } else { + $currentPrefix = $opt['prefix']; + $currentSuffix = $opt['suffix']; + $currentSuffixEnd = $opt['suffix-end']; + } + + $currentName = $start; + $result = []; + + foreach ($source as $key => $val) { + $currentName .= $currentPrefix . $key; + + if (is_array($val) && !empty($val)) { + $currentName .= $currentSuffix; + $result += self::flatten($val, $currentName); + } else { + if ($currentSuffixEnd) { + $currentName .= $currentSuffix; + } + + if (is_resource($val)) { + $result[$currentName] = $val; + } else { + $result[$currentName] = ObjectSerializer::toString($val); + } + } + + $currentName = $start; + } + + return $result; + } + + /** + * formdata must be limited to scalars or arrays of scalar values, + * or a resource for a file upload. Here we iterate through all available + * data and identify how to handle each scenario + * + * @param string|bool|array|DateTime|ArrayAccess|SplFileObject $value + */ + protected function makeFormSafe(mixed $value) + { + if ($value instanceof SplFileObject) { + return $this->processFiles([$value])[0]; + } + + if (is_resource($value)) { + $this->has_file = true; + + return $value; + } + + if ($value instanceof ModelInterface) { + return $this->processModel($value); + } + + if (is_array($value) || is_object($value)) { + $data = []; + + foreach ($value as $k => $v) { + $data[$k] = $this->makeFormSafe($v); + } + + return $data; + } + + return ObjectSerializer::toString($value); + } + + /** + * We are able to handle nested ModelInterface. We do not simply call + * json_decode(json_encode()) because any given model may have binary data + * or other data that cannot be serialized to a JSON string + */ + protected function processModel(ModelInterface $model): array + { + $result = []; + + foreach ($model::openAPITypes() as $name => $type) { + $value = $model->offsetGet($name); + + if ($value === null) { + continue; + } + + if (str_contains($type, '\SplFileObject')) { + $file = is_array($value) ? $value : [$value]; + $result[$name] = $this->processFiles($file); + + continue; + } + + if ($value instanceof ModelInterface) { + $result[$name] = $this->processModel($value); + + continue; + } + + if (is_array($value) || is_object($value)) { + $result[$name] = $this->makeFormSafe($value); + + continue; + } + + $result[$name] = ObjectSerializer::toString($value); + } + + return $result; + } + + /** + * Handle file data + */ + protected function processFiles(array $files): array + { + $this->has_file = true; + + $result = []; + + foreach ($files as $i => $file) { + if (is_array($file)) { + $result[$i] = $this->processFiles($file); + + continue; + } + + if ($file instanceof StreamInterface) { + $result[$i] = $file; + + continue; + } + + if ($file instanceof SplFileObject) { + $result[$i] = $this->tryFopen($file); + } + } + + return $result; + } + + private function tryFopen(SplFileObject $file) + { + return Utils::tryFopen($file->getRealPath(), 'rb'); + } +} diff --git a/src/HeaderSelector.php b/src/HeaderSelector.php new file mode 100644 index 0000000..bff518a --- /dev/null +++ b/src/HeaderSelector.php @@ -0,0 +1,244 @@ +selectAcceptHeader($accept); + if ($accept !== null) { + $headers['Accept'] = $accept; + } + + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } + + $headers['Content-Type'] = $contentType; + } + + return $headers; + } + + /** + * Return the header 'Accept' based on an array of Accept provided. + * + * @param string[] $accept Array of header + * + * @return null|string Accept (e.g. application/json) + */ + private function selectAcceptHeader(array $accept): ?string + { + # filter out empty entries + $accept = array_filter($accept); + + if (count($accept) === 0) { + return null; + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + if (count($headersWithJson) === 0) { + return implode(',', $accept); + } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); + } + + /** + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); + } + + /** + * Given an Accept header, returns an associative array splitting the header and its weight + * + * @param string $header "Accept" Header + * + * @return array with the header and its weight + */ + private function getHeaderAndWeight(string $header): array + { + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; + } else { + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; + } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; + } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); + } + + /** + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) + * + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int + */ + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + { + if ($currentWeight <= 1) { + return 1; + } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; + } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); + } +} diff --git a/src/Model/AddGroupUser200Response.php b/src/Model/AddGroupUser200Response.php new file mode 100644 index 0000000..9485c12 --- /dev/null +++ b/src/Model/AddGroupUser200Response.php @@ -0,0 +1,384 @@ + + */ +class AddGroupUser200Response implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'addGroupUser_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'user' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'user' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'user' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'user' => 'user' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'user' => 'setUser' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'user' => 'getUser' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('user', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets user + * + * @return string|null + */ + public function getUser(): ?string + { + return $this->container['user']; + } + + /** + * Sets user + * + * @param string|null $user User ID that was added + * + * @return $this + */ + public function setUser(?string $user): static + { + if (is_null($user)) { + throw new InvalidArgumentException('non-nullable user cannot be null'); + } + $this->container['user'] = $user; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AddGroupUserRequest.php b/src/Model/AddGroupUserRequest.php new file mode 100644 index 0000000..a26877d --- /dev/null +++ b/src/Model/AddGroupUserRequest.php @@ -0,0 +1,387 @@ + + */ +class AddGroupUserRequest implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'addGroupUser_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'user' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'user' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'user' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'user' => 'user' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'user' => 'setUser' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'user' => 'getUser' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('user', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['user'] === null) { + $invalidProperties[] = "'user' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets user + * + * @return string + */ + public function getUser(): string + { + return $this->container['user']; + } + + /** + * Sets user + * + * @param string $user ID of the student to add + * + * @return $this + */ + public function setUser(string $user): static + { + if (is_null($user)) { + throw new InvalidArgumentException('non-nullable user cannot be null'); + } + $this->container['user'] = $user; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ApiAccessToken.php b/src/Model/ApiAccessToken.php new file mode 100644 index 0000000..4fb906d --- /dev/null +++ b/src/Model/ApiAccessToken.php @@ -0,0 +1,555 @@ + + */ +class ApiAccessToken implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ApiAccessToken'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'token' => 'string', + 'issued_date' => '\DateTime', + 'expiration_date' => '\DateTime', + 'scopes' => '\Flat\APIClient\Model\AppScopes[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'token' => null, + 'issued_date' => 'date-time', + 'expiration_date' => 'date-time', + 'scopes' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'token' => false, + 'issued_date' => false, + 'expiration_date' => false, + 'scopes' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'token' => 'token', + 'issued_date' => 'issuedDate', + 'expiration_date' => 'expirationDate', + 'scopes' => 'scopes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'token' => 'setToken', + 'issued_date' => 'setIssuedDate', + 'expiration_date' => 'setExpirationDate', + 'scopes' => 'setScopes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'token' => 'getToken', + 'issued_date' => 'getIssuedDate', + 'expiration_date' => 'getExpirationDate', + 'scopes' => 'getScopes' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('token', $data ?? [], null); + $this->setIfExists('issued_date', $data ?? [], null); + $this->setIfExists('expiration_date', $data ?? [], null); + $this->setIfExists('scopes', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique identifier of this private token + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the personal access token + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets token + * + * @return string|null + */ + public function getToken(): ?string + { + return $this->container['token']; + } + + /** + * Sets token + * + * @param string|null $token The token. This token will only be returned once, then only the first 4 characters will be returned. + * + * @return $this + */ + public function setToken(?string $token): static + { + if (is_null($token)) { + throw new InvalidArgumentException('non-nullable token cannot be null'); + } + $this->container['token'] = $token; + + return $this; + } + + /** + * Gets issued_date + * + * @return \DateTime|null + */ + public function getIssuedDate(): ?\DateTime + { + return $this->container['issued_date']; + } + + /** + * Sets issued_date + * + * @param \DateTime|null $issued_date The date then this token was issued + * + * @return $this + */ + public function setIssuedDate(?\DateTime $issued_date): static + { + if (is_null($issued_date)) { + throw new InvalidArgumentException('non-nullable issued_date cannot be null'); + } + $this->container['issued_date'] = $issued_date; + + return $this; + } + + /** + * Gets expiration_date + * + * @return \DateTime|null + */ + public function getExpirationDate(): ?\DateTime + { + return $this->container['expiration_date']; + } + + /** + * Sets expiration_date + * + * @param \DateTime|null $expiration_date The date then this token will expire + * + * @return $this + */ + public function setExpirationDate(?\DateTime $expiration_date): static + { + if (is_null($expiration_date)) { + throw new InvalidArgumentException('non-nullable expiration_date cannot be null'); + } + $this->container['expiration_date'] = $expiration_date; + + return $this; + } + + /** + * Gets scopes + * + * @return \Flat\APIClient\Model\AppScopes[]|null + */ + public function getScopes(): ?array + { + return $this->container['scopes']; + } + + /** + * Sets scopes + * + * @param \Flat\APIClient\Model\AppScopes[]|null $scopes The list of scopes associated to the token + * + * @return $this + */ + public function setScopes(?array $scopes): static + { + if (is_null($scopes)) { + throw new InvalidArgumentException('non-nullable scopes cannot be null'); + } + $this->container['scopes'] = $scopes; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AppScopes.php b/src/Model/AppScopes.php new file mode 100644 index 0000000..158a992 --- /dev/null +++ b/src/Model/AppScopes.php @@ -0,0 +1,88 @@ + + */ +class Assignment implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'Assignment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'type' => '\Flat\APIClient\Model\AssignmentType', + 'capabilities' => '\Flat\APIClient\Model\AssignmentCapabilities', + 'title' => 'string', + 'description' => 'string', + 'description_html' => 'string', + 'teacher_instructions' => 'string', + 'teacher_instructions_html' => 'string', + 'cover' => 'string', + 'cover_file' => 'string', + 'attachments' => '\Flat\APIClient\Model\MediaAttachment[]', + 'use_dedicated_attachments' => 'bool', + 'max_points' => 'float', + 'release_grades' => 'string', + 'shuffle_exercises' => 'bool', + 'toolset' => 'string', + 'nb_playback_authorized' => 'float', + 'restrict_play_note' => 'bool', + 'restrict_to_audio_tracks' => 'bool', + 'submission_students_mode' => '\Flat\APIClient\Model\AssignmentSubmissionStudentsMode', + 'recording_type' => 'string', + 'allow_metronome' => 'bool', + 'allow_backing_track' => 'bool', + 'allow_speed_change' => 'bool', + 'free_record' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'type' => null, + 'capabilities' => null, + 'title' => null, + 'description' => null, + 'description_html' => null, + 'teacher_instructions' => null, + 'teacher_instructions_html' => null, + 'cover' => null, + 'cover_file' => null, + 'attachments' => null, + 'use_dedicated_attachments' => null, + 'max_points' => null, + 'release_grades' => null, + 'shuffle_exercises' => null, + 'toolset' => null, + 'nb_playback_authorized' => null, + 'restrict_play_note' => null, + 'restrict_to_audio_tracks' => null, + 'submission_students_mode' => null, + 'recording_type' => null, + 'allow_metronome' => null, + 'allow_backing_track' => null, + 'allow_speed_change' => null, + 'free_record' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'type' => false, + 'capabilities' => false, + 'title' => false, + 'description' => false, + 'description_html' => false, + 'teacher_instructions' => false, + 'teacher_instructions_html' => false, + 'cover' => false, + 'cover_file' => false, + 'attachments' => false, + 'use_dedicated_attachments' => false, + 'max_points' => false, + 'release_grades' => false, + 'shuffle_exercises' => false, + 'toolset' => false, + 'nb_playback_authorized' => false, + 'restrict_play_note' => false, + 'restrict_to_audio_tracks' => false, + 'submission_students_mode' => false, + 'recording_type' => false, + 'allow_metronome' => false, + 'allow_backing_track' => false, + 'allow_speed_change' => false, + 'free_record' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'type' => 'type', + 'capabilities' => 'capabilities', + 'title' => 'title', + 'description' => 'description', + 'description_html' => 'descriptionHtml', + 'teacher_instructions' => 'teacherInstructions', + 'teacher_instructions_html' => 'teacherInstructionsHtml', + 'cover' => 'cover', + 'cover_file' => 'coverFile', + 'attachments' => 'attachments', + 'use_dedicated_attachments' => 'useDedicatedAttachments', + 'max_points' => 'maxPoints', + 'release_grades' => 'releaseGrades', + 'shuffle_exercises' => 'shuffleExercises', + 'toolset' => 'toolset', + 'nb_playback_authorized' => 'nbPlaybackAuthorized', + 'restrict_play_note' => 'restrictPlayNote', + 'restrict_to_audio_tracks' => 'restrictToAudioTracks', + 'submission_students_mode' => 'submissionStudentsMode', + 'recording_type' => 'recordingType', + 'allow_metronome' => 'allowMetronome', + 'allow_backing_track' => 'allowBackingTrack', + 'allow_speed_change' => 'allowSpeedChange', + 'free_record' => 'freeRecord' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'type' => 'setType', + 'capabilities' => 'setCapabilities', + 'title' => 'setTitle', + 'description' => 'setDescription', + 'description_html' => 'setDescriptionHtml', + 'teacher_instructions' => 'setTeacherInstructions', + 'teacher_instructions_html' => 'setTeacherInstructionsHtml', + 'cover' => 'setCover', + 'cover_file' => 'setCoverFile', + 'attachments' => 'setAttachments', + 'use_dedicated_attachments' => 'setUseDedicatedAttachments', + 'max_points' => 'setMaxPoints', + 'release_grades' => 'setReleaseGrades', + 'shuffle_exercises' => 'setShuffleExercises', + 'toolset' => 'setToolset', + 'nb_playback_authorized' => 'setNbPlaybackAuthorized', + 'restrict_play_note' => 'setRestrictPlayNote', + 'restrict_to_audio_tracks' => 'setRestrictToAudioTracks', + 'submission_students_mode' => 'setSubmissionStudentsMode', + 'recording_type' => 'setRecordingType', + 'allow_metronome' => 'setAllowMetronome', + 'allow_backing_track' => 'setAllowBackingTrack', + 'allow_speed_change' => 'setAllowSpeedChange', + 'free_record' => 'setFreeRecord' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'type' => 'getType', + 'capabilities' => 'getCapabilities', + 'title' => 'getTitle', + 'description' => 'getDescription', + 'description_html' => 'getDescriptionHtml', + 'teacher_instructions' => 'getTeacherInstructions', + 'teacher_instructions_html' => 'getTeacherInstructionsHtml', + 'cover' => 'getCover', + 'cover_file' => 'getCoverFile', + 'attachments' => 'getAttachments', + 'use_dedicated_attachments' => 'getUseDedicatedAttachments', + 'max_points' => 'getMaxPoints', + 'release_grades' => 'getReleaseGrades', + 'shuffle_exercises' => 'getShuffleExercises', + 'toolset' => 'getToolset', + 'nb_playback_authorized' => 'getNbPlaybackAuthorized', + 'restrict_play_note' => 'getRestrictPlayNote', + 'restrict_to_audio_tracks' => 'getRestrictToAudioTracks', + 'submission_students_mode' => 'getSubmissionStudentsMode', + 'recording_type' => 'getRecordingType', + 'allow_metronome' => 'getAllowMetronome', + 'allow_backing_track' => 'getAllowBackingTrack', + 'allow_speed_change' => 'getAllowSpeedChange', + 'free_record' => 'getFreeRecord' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const RELEASE_GRADES_AUTO = 'auto'; + public const RELEASE_GRADES_MANUAL = 'manual'; + public const RECORDING_TYPE_AUDIO = 'audio'; + public const RECORDING_TYPE_VIDEO = 'video'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getReleaseGradesAllowableValues() + { + return [ + self::RELEASE_GRADES_AUTO, + self::RELEASE_GRADES_MANUAL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getRecordingTypeAllowableValues() + { + return [ + self::RECORDING_TYPE_AUDIO, + self::RECORDING_TYPE_VIDEO, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('capabilities', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('description_html', $data ?? [], null); + $this->setIfExists('teacher_instructions', $data ?? [], null); + $this->setIfExists('teacher_instructions_html', $data ?? [], null); + $this->setIfExists('cover', $data ?? [], null); + $this->setIfExists('cover_file', $data ?? [], null); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('use_dedicated_attachments', $data ?? [], null); + $this->setIfExists('max_points', $data ?? [], null); + $this->setIfExists('release_grades', $data ?? [], null); + $this->setIfExists('shuffle_exercises', $data ?? [], null); + $this->setIfExists('toolset', $data ?? [], null); + $this->setIfExists('nb_playback_authorized', $data ?? [], null); + $this->setIfExists('restrict_play_note', $data ?? [], null); + $this->setIfExists('restrict_to_audio_tracks', $data ?? [], null); + $this->setIfExists('submission_students_mode', $data ?? [], null); + $this->setIfExists('recording_type', $data ?? [], null); + $this->setIfExists('allow_metronome', $data ?? [], null); + $this->setIfExists('allow_backing_track', $data ?? [], null); + $this->setIfExists('allow_speed_change', $data ?? [], null); + $this->setIfExists('free_record', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['capabilities'] === null) { + $invalidProperties[] = "'capabilities' can't be null"; + } + if ($this->container['title'] === null) { + $invalidProperties[] = "'title' can't be null"; + } + if ($this->container['attachments'] === null) { + $invalidProperties[] = "'attachments' can't be null"; + } + $allowedValues = self::getReleaseGradesAllowableValues(); + if (!is_null($this->container['release_grades']) && !in_array($this->container['release_grades'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'release_grades', must be one of '%s'", + $this->container['release_grades'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = self::getRecordingTypeAllowableValues(); + if (!is_null($this->container['recording_type']) && !in_array($this->container['recording_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'recording_type', must be one of '%s'", + $this->container['recording_type'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Unique identifier of the assignment + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return \Flat\APIClient\Model\AssignmentType + */ + public function getType(): \Flat\APIClient\Model\AssignmentType + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Flat\APIClient\Model\AssignmentType $type type + * + * @return $this + */ + public function setType(\Flat\APIClient\Model\AssignmentType $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets capabilities + * + * @return \Flat\APIClient\Model\AssignmentCapabilities + */ + public function getCapabilities(): \Flat\APIClient\Model\AssignmentCapabilities + { + return $this->container['capabilities']; + } + + /** + * Sets capabilities + * + * @param \Flat\APIClient\Model\AssignmentCapabilities $capabilities capabilities + * + * @return $this + */ + public function setCapabilities(\Flat\APIClient\Model\AssignmentCapabilities $capabilities): static + { + if (is_null($capabilities)) { + throw new InvalidArgumentException('non-nullable capabilities cannot be null'); + } + $this->container['capabilities'] = $capabilities; + + return $this; + } + + /** + * Gets title + * + * @return string + */ + public function getTitle(): string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string $title Title of the assignment + * + * @return $this + */ + public function setTitle(string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Student instructions and content of the assignment (plain text) + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets description_html + * + * @return string|null + */ + public function getDescriptionHtml(): ?string + { + return $this->container['description_html']; + } + + /** + * Sets description_html + * + * @param string|null $description_html HTML version of student instructions with rich text formatting. Supports the following HTML tags: p, br, strong, b, em, i, u, a, ul, ol, li, h1, h2, h3, img. Images are served as absolute http(s) URLs. + * + * @return $this + */ + public function setDescriptionHtml(?string $description_html): static + { + if (is_null($description_html)) { + throw new InvalidArgumentException('non-nullable description_html cannot be null'); + } + $this->container['description_html'] = $description_html; + + return $this; + } + + /** + * Gets teacher_instructions + * + * @return string|null + */ + public function getTeacherInstructions(): ?string + { + return $this->container['teacher_instructions']; + } + + /** + * Sets teacher_instructions + * + * @param string|null $teacher_instructions Teacher-only instructions for this assignment. These instructions are only visible to teachers and are not returned when students view the assignment. If `teacherInstructionsHtml` is provided, this field will contain the plain text version for compatibility. + * + * @return $this + */ + public function setTeacherInstructions(?string $teacher_instructions): static + { + if (is_null($teacher_instructions)) { + throw new InvalidArgumentException('non-nullable teacher_instructions cannot be null'); + } + $this->container['teacher_instructions'] = $teacher_instructions; + + return $this; + } + + /** + * Gets teacher_instructions_html + * + * @return string|null + */ + public function getTeacherInstructionsHtml(): ?string + { + return $this->container['teacher_instructions_html']; + } + + /** + * Sets teacher_instructions_html + * + * @param string|null $teacher_instructions_html HTML version of teacher-only instructions with rich text formatting. Supports the following HTML tags: p, br, strong, b, em, i, u, a, ul, ol, li, h1, h2, h3, img. Images are served as absolute http(s) URLs. + * + * @return $this + */ + public function setTeacherInstructionsHtml(?string $teacher_instructions_html): static + { + if (is_null($teacher_instructions_html)) { + throw new InvalidArgumentException('non-nullable teacher_instructions_html cannot be null'); + } + $this->container['teacher_instructions_html'] = $teacher_instructions_html; + + return $this; + } + + /** + * Gets cover + * + * @return string|null + */ + public function getCover(): ?string + { + return $this->container['cover']; + } + + /** + * Sets cover + * + * @param string|null $cover The URL of the cover to display + * + * @return $this + */ + public function setCover(?string $cover): static + { + if (is_null($cover)) { + throw new InvalidArgumentException('non-nullable cover cannot be null'); + } + $this->container['cover'] = $cover; + + return $this; + } + + /** + * Gets cover_file + * + * @return string|null + */ + public function getCoverFile(): ?string + { + return $this->container['cover_file']; + } + + /** + * Sets cover_file + * + * @param string|null $cover_file The id of the cover to display + * + * @return $this + */ + public function setCoverFile(?string $cover_file): static + { + if (is_null($cover_file)) { + throw new InvalidArgumentException('non-nullable cover_file cannot be null'); + } + $this->container['cover_file'] = $cover_file; + + return $this; + } + + /** + * Gets attachments + * + * @return \Flat\APIClient\Model\MediaAttachment[] + */ + public function getAttachments(): array + { + return $this->container['attachments']; + } + + /** + * Sets attachments + * + * @param \Flat\APIClient\Model\MediaAttachment[] $attachments Reference material handed to the students with the assignment: scores, videos, links and Drive files. A score attached here is the one each student receives their own copy of. + * + * @return $this + */ + public function setAttachments(array $attachments): static + { + if (is_null($attachments)) { + throw new InvalidArgumentException('non-nullable attachments cannot be null'); + } + $this->container['attachments'] = $attachments; + + return $this; + } + + /** + * Gets use_dedicated_attachments + * + * @return bool|null + */ + public function getUseDedicatedAttachments(): ?bool + { + return $this->container['use_dedicated_attachments']; + } + + /** + * Sets use_dedicated_attachments + * + * @param bool|null $use_dedicated_attachments For all assignments created after 02/2023, all the underlying resources must be dedicated and stored in the assignment. This boolean indicates that this assignment only supports dedicated attachments. + * + * @return $this + */ + public function setUseDedicatedAttachments(?bool $use_dedicated_attachments): static + { + if (is_null($use_dedicated_attachments)) { + throw new InvalidArgumentException('non-nullable use_dedicated_attachments cannot be null'); + } + $this->container['use_dedicated_attachments'] = $use_dedicated_attachments; + + return $this; + } + + /** + * Gets max_points + * + * @return float|null + */ + public function getMaxPoints(): ?float + { + return $this->container['max_points']; + } + + /** + * Sets max_points + * + * @param float|null $max_points If set, the grading will be enabled for the assignement + * + * @return $this + */ + public function setMaxPoints(?float $max_points): static + { + if (is_null($max_points)) { + throw new InvalidArgumentException('non-nullable max_points cannot be null'); + } + $this->container['max_points'] = $max_points; + + return $this; + } + + /** + * Gets release_grades + * + * @return string|null + */ + public function getReleaseGrades(): ?string + { + return $this->container['release_grades']; + } + + /** + * Sets release_grades + * + * @param string|null $release_grades For worksheets, how grading will work for the assignment: - If set to `auto`, the grades will be automatically released when the student submits the submissions - If set to `manual`, the grades will only be set as `draftGrade` and will be released when the teacher returns the submissions + * + * @return $this + */ + public function setReleaseGrades(?string $release_grades): static + { + if (is_null($release_grades)) { + throw new InvalidArgumentException('non-nullable release_grades cannot be null'); + } + $allowedValues = self::getReleaseGradesAllowableValues(); + if (!in_array($release_grades, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'release_grades', must be one of '%s'", + $release_grades, + implode("', '", $allowedValues) + ) + ); + } + $this->container['release_grades'] = $release_grades; + + return $this; + } + + /** + * Gets shuffle_exercises + * + * @return bool|null + */ + public function getShuffleExercises(): ?bool + { + return $this->container['shuffle_exercises']; + } + + /** + * Sets shuffle_exercises + * + * @param bool|null $shuffle_exercises Mixing worksheets exercises for each student + * + * @return $this + */ + public function setShuffleExercises(?bool $shuffle_exercises): static + { + if (is_null($shuffle_exercises)) { + throw new InvalidArgumentException('non-nullable shuffle_exercises cannot be null'); + } + $this->container['shuffle_exercises'] = $shuffle_exercises; + + return $this; + } + + /** + * Gets toolset + * + * @return string|null + */ + public function getToolset(): ?string + { + return $this->container['toolset']; + } + + /** + * Sets toolset + * + * @param string|null $toolset The id of the associated toolset + * + * @return $this + */ + public function setToolset(?string $toolset): static + { + if (is_null($toolset)) { + throw new InvalidArgumentException('non-nullable toolset cannot be null'); + } + $this->container['toolset'] = $toolset; + + return $this; + } + + /** + * Gets nb_playback_authorized + * + * @return float|null + */ + public function getNbPlaybackAuthorized(): ?float + { + return $this->container['nb_playback_authorized']; + } + + /** + * Sets nb_playback_authorized + * + * @param float|null $nb_playback_authorized The number of playback authorized on the scores of the assignment. + * + * @return $this + */ + public function setNbPlaybackAuthorized(?float $nb_playback_authorized): static + { + if (is_null($nb_playback_authorized)) { + throw new InvalidArgumentException('non-nullable nb_playback_authorized cannot be null'); + } + $this->container['nb_playback_authorized'] = $nb_playback_authorized; + + return $this; + } + + /** + * Gets restrict_play_note + * + * @return bool|null + */ + public function getRestrictPlayNote(): ?bool + { + return $this->container['restrict_play_note']; + } + + /** + * Sets restrict_play_note + * + * @param bool|null $restrict_play_note Restrict the ability to get an audio feedback every time a student adds or selects a note. + * + * @return $this + */ + public function setRestrictPlayNote(?bool $restrict_play_note): static + { + if (is_null($restrict_play_note)) { + throw new InvalidArgumentException('non-nullable restrict_play_note cannot be null'); + } + $this->container['restrict_play_note'] = $restrict_play_note; + + return $this; + } + + /** + * Gets restrict_to_audio_tracks + * + * @return bool|null + */ + public function getRestrictToAudioTracks(): ?bool + { + return $this->container['restrict_to_audio_tracks']; + } + + /** + * Sets restrict_to_audio_tracks + * + * @param bool|null $restrict_to_audio_tracks Restrict the audio source to provided audio tracks on a score. Students won't be able to use the editor playback. + * + * @return $this + */ + public function setRestrictToAudioTracks(?bool $restrict_to_audio_tracks): static + { + if (is_null($restrict_to_audio_tracks)) { + throw new InvalidArgumentException('non-nullable restrict_to_audio_tracks cannot be null'); + } + $this->container['restrict_to_audio_tracks'] = $restrict_to_audio_tracks; + + return $this; + } + + /** + * Gets submission_students_mode + * + * @return \Flat\APIClient\Model\AssignmentSubmissionStudentsMode|null + */ + public function getSubmissionStudentsMode(): ?\Flat\APIClient\Model\AssignmentSubmissionStudentsMode + { + return $this->container['submission_students_mode']; + } + + /** + * Sets submission_students_mode + * + * @param \Flat\APIClient\Model\AssignmentSubmissionStudentsMode|null $submission_students_mode submission_students_mode + * + * @return $this + */ + public function setSubmissionStudentsMode(?\Flat\APIClient\Model\AssignmentSubmissionStudentsMode $submission_students_mode): static + { + if (is_null($submission_students_mode)) { + throw new InvalidArgumentException('non-nullable submission_students_mode cannot be null'); + } + $this->container['submission_students_mode'] = $submission_students_mode; + + return $this; + } + + /** + * Gets recording_type + * + * @return string|null + */ + public function getRecordingType(): ?string + { + return $this->container['recording_type']; + } + + /** + * Sets recording_type + * + * @param string|null $recording_type For performance assignments: recording type that will be either 'audio' or 'video'. * `audio`: Only audio will be required during the recording. * `video`: Camera will be required during the recording. Only set when type is 'performance'. + * + * @return $this + */ + public function setRecordingType(?string $recording_type): static + { + if (is_null($recording_type)) { + throw new InvalidArgumentException('non-nullable recording_type cannot be null'); + } + $allowedValues = self::getRecordingTypeAllowableValues(); + if (!in_array($recording_type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'recording_type', must be one of '%s'", + $recording_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['recording_type'] = $recording_type; + + return $this; + } + + /** + * Gets allow_metronome + * + * @return bool|null + */ + public function getAllowMetronome(): ?bool + { + return $this->container['allow_metronome']; + } + + /** + * Sets allow_metronome + * + * @param bool|null $allow_metronome For performance assignments: Enable students to use the metronome while they are recording, helping them stay in time. Only set when type is 'performance'. + * + * @return $this + */ + public function setAllowMetronome(?bool $allow_metronome): static + { + if (is_null($allow_metronome)) { + throw new InvalidArgumentException('non-nullable allow_metronome cannot be null'); + } + $this->container['allow_metronome'] = $allow_metronome; + + return $this; + } + + /** + * Gets allow_backing_track + * + * @return bool|null + */ + public function getAllowBackingTrack(): ?bool + { + return $this->container['allow_backing_track']; + } + + /** + * Sets allow_backing_track + * + * @param bool|null $allow_backing_track For performance assignments: Enable students to listen to the accompaniment without their instrument part while they are playing. Only set when type is 'performance'. + * + * @return $this + */ + public function setAllowBackingTrack(?bool $allow_backing_track): static + { + if (is_null($allow_backing_track)) { + throw new InvalidArgumentException('non-nullable allow_backing_track cannot be null'); + } + $this->container['allow_backing_track'] = $allow_backing_track; + + return $this; + } + + /** + * Gets allow_speed_change + * + * @return bool|null + */ + public function getAllowSpeedChange(): ?bool + { + return $this->container['allow_speed_change']; + } + + /** + * Sets allow_speed_change + * + * @param bool|null $allow_speed_change For performance assignments: whether students can adjust the playback speed of the score during recording. * `true`: Students can change the tempo/speed during practice and recording * `false`: Tempo is fixed to the original score tempo Only set when type is 'performance'. + * + * @return $this + */ + public function setAllowSpeedChange(?bool $allow_speed_change): static + { + if (is_null($allow_speed_change)) { + throw new InvalidArgumentException('non-nullable allow_speed_change cannot be null'); + } + $this->container['allow_speed_change'] = $allow_speed_change; + + return $this; + } + + /** + * Gets free_record + * + * @return bool|null + */ + public function getFreeRecord(): ?bool + { + return $this->container['free_record']; + } + + /** + * Sets free_record + * + * @param bool|null $free_record For performance assignments: \"Free Record\" mode. When `true`, no score is attached to the assignment. Students freely record a varied repertoire or an ensemble performance without being constrained by a single score's structure or duration, and all score-dependent options (playback, metronome, backtracking, speed control) are hidden. Only set when type is 'performance'. + * + * @return $this + */ + public function setFreeRecord(?bool $free_record): static + { + if (is_null($free_record)) { + throw new InvalidArgumentException('non-nullable free_record cannot be null'); + } + $this->container['free_record'] = $free_record; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AssignmentCapabilities.php b/src/Model/AssignmentCapabilities.php new file mode 100644 index 0000000..4e5b8dd --- /dev/null +++ b/src/Model/AssignmentCapabilities.php @@ -0,0 +1,533 @@ + + */ +class AssignmentCapabilities implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'Assignment_capabilities'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'can_edit' => 'bool', + 'can_publish_in_class' => 'bool', + 'can_publish_in_class_error' => '\Flat\APIClient\Model\AssignmentCapabilitiesCanPublishInClassError', + 'can_archive' => 'bool', + 'can_unarchive' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'can_edit' => null, + 'can_publish_in_class' => null, + 'can_publish_in_class_error' => null, + 'can_archive' => null, + 'can_unarchive' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'can_edit' => false, + 'can_publish_in_class' => false, + 'can_publish_in_class_error' => false, + 'can_archive' => false, + 'can_unarchive' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'can_edit' => 'canEdit', + 'can_publish_in_class' => 'canPublishInClass', + 'can_publish_in_class_error' => 'canPublishInClassError', + 'can_archive' => 'canArchive', + 'can_unarchive' => 'canUnarchive' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'can_edit' => 'setCanEdit', + 'can_publish_in_class' => 'setCanPublishInClass', + 'can_publish_in_class_error' => 'setCanPublishInClassError', + 'can_archive' => 'setCanArchive', + 'can_unarchive' => 'setCanUnarchive' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'can_edit' => 'getCanEdit', + 'can_publish_in_class' => 'getCanPublishInClass', + 'can_publish_in_class_error' => 'getCanPublishInClassError', + 'can_archive' => 'getCanArchive', + 'can_unarchive' => 'getCanUnarchive' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('can_edit', $data ?? [], null); + $this->setIfExists('can_publish_in_class', $data ?? [], null); + $this->setIfExists('can_publish_in_class_error', $data ?? [], null); + $this->setIfExists('can_archive', $data ?? [], null); + $this->setIfExists('can_unarchive', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['can_edit'] === null) { + $invalidProperties[] = "'can_edit' can't be null"; + } + if ($this->container['can_publish_in_class'] === null) { + $invalidProperties[] = "'can_publish_in_class' can't be null"; + } + if ($this->container['can_archive'] === null) { + $invalidProperties[] = "'can_archive' can't be null"; + } + if ($this->container['can_unarchive'] === null) { + $invalidProperties[] = "'can_unarchive' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets can_edit + * + * @return bool + */ + public function getCanEdit(): bool + { + return $this->container['can_edit']; + } + + /** + * Sets can_edit + * + * @param bool $can_edit Whether the current user can edit the assignment + * + * @return $this + */ + public function setCanEdit(bool $can_edit): static + { + if (is_null($can_edit)) { + throw new InvalidArgumentException('non-nullable can_edit cannot be null'); + } + $this->container['can_edit'] = $can_edit; + + return $this; + } + + /** + * Gets can_publish_in_class + * + * @return bool + */ + public function getCanPublishInClass(): bool + { + return $this->container['can_publish_in_class']; + } + + /** + * Sets can_publish_in_class + * + * @param bool $can_publish_in_class Whether this assignment can be published in a class + * + * @return $this + */ + public function setCanPublishInClass(bool $can_publish_in_class): static + { + if (is_null($can_publish_in_class)) { + throw new InvalidArgumentException('non-nullable can_publish_in_class cannot be null'); + } + $this->container['can_publish_in_class'] = $can_publish_in_class; + + return $this; + } + + /** + * Gets can_publish_in_class_error + * + * @return \Flat\APIClient\Model\AssignmentCapabilitiesCanPublishInClassError|null + */ + public function getCanPublishInClassError(): ?\Flat\APIClient\Model\AssignmentCapabilitiesCanPublishInClassError + { + return $this->container['can_publish_in_class_error']; + } + + /** + * Sets can_publish_in_class_error + * + * @param \Flat\APIClient\Model\AssignmentCapabilitiesCanPublishInClassError|null $can_publish_in_class_error can_publish_in_class_error + * + * @return $this + */ + public function setCanPublishInClassError(?\Flat\APIClient\Model\AssignmentCapabilitiesCanPublishInClassError $can_publish_in_class_error): static + { + if (is_null($can_publish_in_class_error)) { + throw new InvalidArgumentException('non-nullable can_publish_in_class_error cannot be null'); + } + $this->container['can_publish_in_class_error'] = $can_publish_in_class_error; + + return $this; + } + + /** + * Gets can_archive + * + * @return bool + */ + public function getCanArchive(): bool + { + return $this->container['can_archive']; + } + + /** + * Sets can_archive + * + * @param bool $can_archive Whether the current user can archive the assignment + * + * @return $this + */ + public function setCanArchive(bool $can_archive): static + { + if (is_null($can_archive)) { + throw new InvalidArgumentException('non-nullable can_archive cannot be null'); + } + $this->container['can_archive'] = $can_archive; + + return $this; + } + + /** + * Gets can_unarchive + * + * @return bool + */ + public function getCanUnarchive(): bool + { + return $this->container['can_unarchive']; + } + + /** + * Sets can_unarchive + * + * @param bool $can_unarchive Whether the current user can unarchive the assignment + * + * @return $this + */ + public function setCanUnarchive(bool $can_unarchive): static + { + if (is_null($can_unarchive)) { + throw new InvalidArgumentException('non-nullable can_unarchive cannot be null'); + } + $this->container['can_unarchive'] = $can_unarchive; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AssignmentCapabilitiesCanPublishInClassError.php b/src/Model/AssignmentCapabilitiesCanPublishInClassError.php new file mode 100644 index 0000000..2ec46e4 --- /dev/null +++ b/src/Model/AssignmentCapabilitiesCanPublishInClassError.php @@ -0,0 +1,425 @@ + + */ +class AssignmentCapabilitiesCanPublishInClassError implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'Assignment_capabilities_canPublishInClassError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'code' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'code' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'code' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'code' => 'code', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'code' => 'setCode', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'code' => 'getCode', + 'message' => 'getMessage' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['code'] === null) { + $invalidProperties[] = "'code' can't be null"; + } + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets code + * + * @return string + */ + public function getCode(): string + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string $code A corresponding code for this error + * + * @return $this + */ + public function setCode(string $code): static + { + if (is_null($code)) { + throw new InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage(): string + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message A printable and localized message for this error + * + * @return $this + */ + public function setMessage(string $message): static + { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AssignmentCopy.php b/src/Model/AssignmentCopy.php new file mode 100644 index 0000000..9e53427 --- /dev/null +++ b/src/Model/AssignmentCopy.php @@ -0,0 +1,84 @@ + + */ +class AssignmentCopyResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'AssignmentCopyResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'type' => '\Flat\APIClient\Model\AssignmentType', + 'capabilities' => '\Flat\APIClient\Model\AssignmentCapabilities', + 'title' => 'string', + 'description' => 'string', + 'description_html' => 'string', + 'teacher_instructions' => 'string', + 'teacher_instructions_html' => 'string', + 'cover' => 'string', + 'cover_file' => 'string', + 'attachments' => '\Flat\APIClient\Model\MediaAttachment[]', + 'use_dedicated_attachments' => 'bool', + 'max_points' => 'float', + 'release_grades' => 'string', + 'shuffle_exercises' => 'bool', + 'toolset' => 'string', + 'nb_playback_authorized' => 'float', + 'restrict_play_note' => 'bool', + 'restrict_to_audio_tracks' => 'bool', + 'submission_students_mode' => '\Flat\APIClient\Model\AssignmentSubmissionStudentsMode', + 'recording_type' => 'string', + 'allow_metronome' => 'bool', + 'allow_backing_track' => 'bool', + 'allow_speed_change' => 'bool', + 'free_record' => 'bool', + 'resource' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'type' => null, + 'capabilities' => null, + 'title' => null, + 'description' => null, + 'description_html' => null, + 'teacher_instructions' => null, + 'teacher_instructions_html' => null, + 'cover' => null, + 'cover_file' => null, + 'attachments' => null, + 'use_dedicated_attachments' => null, + 'max_points' => null, + 'release_grades' => null, + 'shuffle_exercises' => null, + 'toolset' => null, + 'nb_playback_authorized' => null, + 'restrict_play_note' => null, + 'restrict_to_audio_tracks' => null, + 'submission_students_mode' => null, + 'recording_type' => null, + 'allow_metronome' => null, + 'allow_backing_track' => null, + 'allow_speed_change' => null, + 'free_record' => null, + 'resource' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'type' => false, + 'capabilities' => false, + 'title' => false, + 'description' => false, + 'description_html' => false, + 'teacher_instructions' => false, + 'teacher_instructions_html' => false, + 'cover' => false, + 'cover_file' => false, + 'attachments' => false, + 'use_dedicated_attachments' => false, + 'max_points' => false, + 'release_grades' => false, + 'shuffle_exercises' => false, + 'toolset' => false, + 'nb_playback_authorized' => false, + 'restrict_play_note' => false, + 'restrict_to_audio_tracks' => false, + 'submission_students_mode' => false, + 'recording_type' => false, + 'allow_metronome' => false, + 'allow_backing_track' => false, + 'allow_speed_change' => false, + 'free_record' => false, + 'resource' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'type' => 'type', + 'capabilities' => 'capabilities', + 'title' => 'title', + 'description' => 'description', + 'description_html' => 'descriptionHtml', + 'teacher_instructions' => 'teacherInstructions', + 'teacher_instructions_html' => 'teacherInstructionsHtml', + 'cover' => 'cover', + 'cover_file' => 'coverFile', + 'attachments' => 'attachments', + 'use_dedicated_attachments' => 'useDedicatedAttachments', + 'max_points' => 'maxPoints', + 'release_grades' => 'releaseGrades', + 'shuffle_exercises' => 'shuffleExercises', + 'toolset' => 'toolset', + 'nb_playback_authorized' => 'nbPlaybackAuthorized', + 'restrict_play_note' => 'restrictPlayNote', + 'restrict_to_audio_tracks' => 'restrictToAudioTracks', + 'submission_students_mode' => 'submissionStudentsMode', + 'recording_type' => 'recordingType', + 'allow_metronome' => 'allowMetronome', + 'allow_backing_track' => 'allowBackingTrack', + 'allow_speed_change' => 'allowSpeedChange', + 'free_record' => 'freeRecord', + 'resource' => 'resource' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'type' => 'setType', + 'capabilities' => 'setCapabilities', + 'title' => 'setTitle', + 'description' => 'setDescription', + 'description_html' => 'setDescriptionHtml', + 'teacher_instructions' => 'setTeacherInstructions', + 'teacher_instructions_html' => 'setTeacherInstructionsHtml', + 'cover' => 'setCover', + 'cover_file' => 'setCoverFile', + 'attachments' => 'setAttachments', + 'use_dedicated_attachments' => 'setUseDedicatedAttachments', + 'max_points' => 'setMaxPoints', + 'release_grades' => 'setReleaseGrades', + 'shuffle_exercises' => 'setShuffleExercises', + 'toolset' => 'setToolset', + 'nb_playback_authorized' => 'setNbPlaybackAuthorized', + 'restrict_play_note' => 'setRestrictPlayNote', + 'restrict_to_audio_tracks' => 'setRestrictToAudioTracks', + 'submission_students_mode' => 'setSubmissionStudentsMode', + 'recording_type' => 'setRecordingType', + 'allow_metronome' => 'setAllowMetronome', + 'allow_backing_track' => 'setAllowBackingTrack', + 'allow_speed_change' => 'setAllowSpeedChange', + 'free_record' => 'setFreeRecord', + 'resource' => 'setResource' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'type' => 'getType', + 'capabilities' => 'getCapabilities', + 'title' => 'getTitle', + 'description' => 'getDescription', + 'description_html' => 'getDescriptionHtml', + 'teacher_instructions' => 'getTeacherInstructions', + 'teacher_instructions_html' => 'getTeacherInstructionsHtml', + 'cover' => 'getCover', + 'cover_file' => 'getCoverFile', + 'attachments' => 'getAttachments', + 'use_dedicated_attachments' => 'getUseDedicatedAttachments', + 'max_points' => 'getMaxPoints', + 'release_grades' => 'getReleaseGrades', + 'shuffle_exercises' => 'getShuffleExercises', + 'toolset' => 'getToolset', + 'nb_playback_authorized' => 'getNbPlaybackAuthorized', + 'restrict_play_note' => 'getRestrictPlayNote', + 'restrict_to_audio_tracks' => 'getRestrictToAudioTracks', + 'submission_students_mode' => 'getSubmissionStudentsMode', + 'recording_type' => 'getRecordingType', + 'allow_metronome' => 'getAllowMetronome', + 'allow_backing_track' => 'getAllowBackingTrack', + 'allow_speed_change' => 'getAllowSpeedChange', + 'free_record' => 'getFreeRecord', + 'resource' => 'getResource' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const RELEASE_GRADES_AUTO = 'auto'; + public const RELEASE_GRADES_MANUAL = 'manual'; + public const RECORDING_TYPE_AUDIO = 'audio'; + public const RECORDING_TYPE_VIDEO = 'video'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getReleaseGradesAllowableValues() + { + return [ + self::RELEASE_GRADES_AUTO, + self::RELEASE_GRADES_MANUAL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getRecordingTypeAllowableValues() + { + return [ + self::RECORDING_TYPE_AUDIO, + self::RECORDING_TYPE_VIDEO, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('capabilities', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('description_html', $data ?? [], null); + $this->setIfExists('teacher_instructions', $data ?? [], null); + $this->setIfExists('teacher_instructions_html', $data ?? [], null); + $this->setIfExists('cover', $data ?? [], null); + $this->setIfExists('cover_file', $data ?? [], null); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('use_dedicated_attachments', $data ?? [], null); + $this->setIfExists('max_points', $data ?? [], null); + $this->setIfExists('release_grades', $data ?? [], null); + $this->setIfExists('shuffle_exercises', $data ?? [], null); + $this->setIfExists('toolset', $data ?? [], null); + $this->setIfExists('nb_playback_authorized', $data ?? [], null); + $this->setIfExists('restrict_play_note', $data ?? [], null); + $this->setIfExists('restrict_to_audio_tracks', $data ?? [], null); + $this->setIfExists('submission_students_mode', $data ?? [], null); + $this->setIfExists('recording_type', $data ?? [], null); + $this->setIfExists('allow_metronome', $data ?? [], null); + $this->setIfExists('allow_backing_track', $data ?? [], null); + $this->setIfExists('allow_speed_change', $data ?? [], null); + $this->setIfExists('free_record', $data ?? [], null); + $this->setIfExists('resource', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['capabilities'] === null) { + $invalidProperties[] = "'capabilities' can't be null"; + } + if ($this->container['title'] === null) { + $invalidProperties[] = "'title' can't be null"; + } + if ($this->container['attachments'] === null) { + $invalidProperties[] = "'attachments' can't be null"; + } + $allowedValues = self::getReleaseGradesAllowableValues(); + if (!is_null($this->container['release_grades']) && !in_array($this->container['release_grades'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'release_grades', must be one of '%s'", + $this->container['release_grades'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = self::getRecordingTypeAllowableValues(); + if (!is_null($this->container['recording_type']) && !in_array($this->container['recording_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'recording_type', must be one of '%s'", + $this->container['recording_type'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Unique identifier of the assignment + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return \Flat\APIClient\Model\AssignmentType + */ + public function getType(): \Flat\APIClient\Model\AssignmentType + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Flat\APIClient\Model\AssignmentType $type type + * + * @return $this + */ + public function setType(\Flat\APIClient\Model\AssignmentType $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets capabilities + * + * @return \Flat\APIClient\Model\AssignmentCapabilities + */ + public function getCapabilities(): \Flat\APIClient\Model\AssignmentCapabilities + { + return $this->container['capabilities']; + } + + /** + * Sets capabilities + * + * @param \Flat\APIClient\Model\AssignmentCapabilities $capabilities capabilities + * + * @return $this + */ + public function setCapabilities(\Flat\APIClient\Model\AssignmentCapabilities $capabilities): static + { + if (is_null($capabilities)) { + throw new InvalidArgumentException('non-nullable capabilities cannot be null'); + } + $this->container['capabilities'] = $capabilities; + + return $this; + } + + /** + * Gets title + * + * @return string + */ + public function getTitle(): string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string $title Title of the assignment + * + * @return $this + */ + public function setTitle(string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Student instructions and content of the assignment (plain text) + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets description_html + * + * @return string|null + */ + public function getDescriptionHtml(): ?string + { + return $this->container['description_html']; + } + + /** + * Sets description_html + * + * @param string|null $description_html HTML version of student instructions with rich text formatting. Supports the following HTML tags: p, br, strong, b, em, i, u, a, ul, ol, li, h1, h2, h3, img. Images are served as absolute http(s) URLs. + * + * @return $this + */ + public function setDescriptionHtml(?string $description_html): static + { + if (is_null($description_html)) { + throw new InvalidArgumentException('non-nullable description_html cannot be null'); + } + $this->container['description_html'] = $description_html; + + return $this; + } + + /** + * Gets teacher_instructions + * + * @return string|null + */ + public function getTeacherInstructions(): ?string + { + return $this->container['teacher_instructions']; + } + + /** + * Sets teacher_instructions + * + * @param string|null $teacher_instructions Teacher-only instructions for this assignment. These instructions are only visible to teachers and are not returned when students view the assignment. If `teacherInstructionsHtml` is provided, this field will contain the plain text version for compatibility. + * + * @return $this + */ + public function setTeacherInstructions(?string $teacher_instructions): static + { + if (is_null($teacher_instructions)) { + throw new InvalidArgumentException('non-nullable teacher_instructions cannot be null'); + } + $this->container['teacher_instructions'] = $teacher_instructions; + + return $this; + } + + /** + * Gets teacher_instructions_html + * + * @return string|null + */ + public function getTeacherInstructionsHtml(): ?string + { + return $this->container['teacher_instructions_html']; + } + + /** + * Sets teacher_instructions_html + * + * @param string|null $teacher_instructions_html HTML version of teacher-only instructions with rich text formatting. Supports the following HTML tags: p, br, strong, b, em, i, u, a, ul, ol, li, h1, h2, h3, img. Images are served as absolute http(s) URLs. + * + * @return $this + */ + public function setTeacherInstructionsHtml(?string $teacher_instructions_html): static + { + if (is_null($teacher_instructions_html)) { + throw new InvalidArgumentException('non-nullable teacher_instructions_html cannot be null'); + } + $this->container['teacher_instructions_html'] = $teacher_instructions_html; + + return $this; + } + + /** + * Gets cover + * + * @return string|null + */ + public function getCover(): ?string + { + return $this->container['cover']; + } + + /** + * Sets cover + * + * @param string|null $cover The URL of the cover to display + * + * @return $this + */ + public function setCover(?string $cover): static + { + if (is_null($cover)) { + throw new InvalidArgumentException('non-nullable cover cannot be null'); + } + $this->container['cover'] = $cover; + + return $this; + } + + /** + * Gets cover_file + * + * @return string|null + */ + public function getCoverFile(): ?string + { + return $this->container['cover_file']; + } + + /** + * Sets cover_file + * + * @param string|null $cover_file The id of the cover to display + * + * @return $this + */ + public function setCoverFile(?string $cover_file): static + { + if (is_null($cover_file)) { + throw new InvalidArgumentException('non-nullable cover_file cannot be null'); + } + $this->container['cover_file'] = $cover_file; + + return $this; + } + + /** + * Gets attachments + * + * @return \Flat\APIClient\Model\MediaAttachment[] + */ + public function getAttachments(): array + { + return $this->container['attachments']; + } + + /** + * Sets attachments + * + * @param \Flat\APIClient\Model\MediaAttachment[] $attachments Reference material handed to the students with the assignment: scores, videos, links and Drive files. A score attached here is the one each student receives their own copy of. + * + * @return $this + */ + public function setAttachments(array $attachments): static + { + if (is_null($attachments)) { + throw new InvalidArgumentException('non-nullable attachments cannot be null'); + } + $this->container['attachments'] = $attachments; + + return $this; + } + + /** + * Gets use_dedicated_attachments + * + * @return bool|null + */ + public function getUseDedicatedAttachments(): ?bool + { + return $this->container['use_dedicated_attachments']; + } + + /** + * Sets use_dedicated_attachments + * + * @param bool|null $use_dedicated_attachments For all assignments created after 02/2023, all the underlying resources must be dedicated and stored in the assignment. This boolean indicates that this assignment only supports dedicated attachments. + * + * @return $this + */ + public function setUseDedicatedAttachments(?bool $use_dedicated_attachments): static + { + if (is_null($use_dedicated_attachments)) { + throw new InvalidArgumentException('non-nullable use_dedicated_attachments cannot be null'); + } + $this->container['use_dedicated_attachments'] = $use_dedicated_attachments; + + return $this; + } + + /** + * Gets max_points + * + * @return float|null + */ + public function getMaxPoints(): ?float + { + return $this->container['max_points']; + } + + /** + * Sets max_points + * + * @param float|null $max_points If set, the grading will be enabled for the assignement + * + * @return $this + */ + public function setMaxPoints(?float $max_points): static + { + if (is_null($max_points)) { + throw new InvalidArgumentException('non-nullable max_points cannot be null'); + } + $this->container['max_points'] = $max_points; + + return $this; + } + + /** + * Gets release_grades + * + * @return string|null + */ + public function getReleaseGrades(): ?string + { + return $this->container['release_grades']; + } + + /** + * Sets release_grades + * + * @param string|null $release_grades For worksheets, how grading will work for the assignment: - If set to `auto`, the grades will be automatically released when the student submits the submissions - If set to `manual`, the grades will only be set as `draftGrade` and will be released when the teacher returns the submissions + * + * @return $this + */ + public function setReleaseGrades(?string $release_grades): static + { + if (is_null($release_grades)) { + throw new InvalidArgumentException('non-nullable release_grades cannot be null'); + } + $allowedValues = self::getReleaseGradesAllowableValues(); + if (!in_array($release_grades, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'release_grades', must be one of '%s'", + $release_grades, + implode("', '", $allowedValues) + ) + ); + } + $this->container['release_grades'] = $release_grades; + + return $this; + } + + /** + * Gets shuffle_exercises + * + * @return bool|null + */ + public function getShuffleExercises(): ?bool + { + return $this->container['shuffle_exercises']; + } + + /** + * Sets shuffle_exercises + * + * @param bool|null $shuffle_exercises Mixing worksheets exercises for each student + * + * @return $this + */ + public function setShuffleExercises(?bool $shuffle_exercises): static + { + if (is_null($shuffle_exercises)) { + throw new InvalidArgumentException('non-nullable shuffle_exercises cannot be null'); + } + $this->container['shuffle_exercises'] = $shuffle_exercises; + + return $this; + } + + /** + * Gets toolset + * + * @return string|null + */ + public function getToolset(): ?string + { + return $this->container['toolset']; + } + + /** + * Sets toolset + * + * @param string|null $toolset The id of the associated toolset + * + * @return $this + */ + public function setToolset(?string $toolset): static + { + if (is_null($toolset)) { + throw new InvalidArgumentException('non-nullable toolset cannot be null'); + } + $this->container['toolset'] = $toolset; + + return $this; + } + + /** + * Gets nb_playback_authorized + * + * @return float|null + */ + public function getNbPlaybackAuthorized(): ?float + { + return $this->container['nb_playback_authorized']; + } + + /** + * Sets nb_playback_authorized + * + * @param float|null $nb_playback_authorized The number of playback authorized on the scores of the assignment. + * + * @return $this + */ + public function setNbPlaybackAuthorized(?float $nb_playback_authorized): static + { + if (is_null($nb_playback_authorized)) { + throw new InvalidArgumentException('non-nullable nb_playback_authorized cannot be null'); + } + $this->container['nb_playback_authorized'] = $nb_playback_authorized; + + return $this; + } + + /** + * Gets restrict_play_note + * + * @return bool|null + */ + public function getRestrictPlayNote(): ?bool + { + return $this->container['restrict_play_note']; + } + + /** + * Sets restrict_play_note + * + * @param bool|null $restrict_play_note Restrict the ability to get an audio feedback every time a student adds or selects a note. + * + * @return $this + */ + public function setRestrictPlayNote(?bool $restrict_play_note): static + { + if (is_null($restrict_play_note)) { + throw new InvalidArgumentException('non-nullable restrict_play_note cannot be null'); + } + $this->container['restrict_play_note'] = $restrict_play_note; + + return $this; + } + + /** + * Gets restrict_to_audio_tracks + * + * @return bool|null + */ + public function getRestrictToAudioTracks(): ?bool + { + return $this->container['restrict_to_audio_tracks']; + } + + /** + * Sets restrict_to_audio_tracks + * + * @param bool|null $restrict_to_audio_tracks Restrict the audio source to provided audio tracks on a score. Students won't be able to use the editor playback. + * + * @return $this + */ + public function setRestrictToAudioTracks(?bool $restrict_to_audio_tracks): static + { + if (is_null($restrict_to_audio_tracks)) { + throw new InvalidArgumentException('non-nullable restrict_to_audio_tracks cannot be null'); + } + $this->container['restrict_to_audio_tracks'] = $restrict_to_audio_tracks; + + return $this; + } + + /** + * Gets submission_students_mode + * + * @return \Flat\APIClient\Model\AssignmentSubmissionStudentsMode|null + */ + public function getSubmissionStudentsMode(): ?\Flat\APIClient\Model\AssignmentSubmissionStudentsMode + { + return $this->container['submission_students_mode']; + } + + /** + * Sets submission_students_mode + * + * @param \Flat\APIClient\Model\AssignmentSubmissionStudentsMode|null $submission_students_mode submission_students_mode + * + * @return $this + */ + public function setSubmissionStudentsMode(?\Flat\APIClient\Model\AssignmentSubmissionStudentsMode $submission_students_mode): static + { + if (is_null($submission_students_mode)) { + throw new InvalidArgumentException('non-nullable submission_students_mode cannot be null'); + } + $this->container['submission_students_mode'] = $submission_students_mode; + + return $this; + } + + /** + * Gets recording_type + * + * @return string|null + */ + public function getRecordingType(): ?string + { + return $this->container['recording_type']; + } + + /** + * Sets recording_type + * + * @param string|null $recording_type For performance assignments: recording type that will be either 'audio' or 'video'. * `audio`: Only audio will be required during the recording. * `video`: Camera will be required during the recording. Only set when type is 'performance'. + * + * @return $this + */ + public function setRecordingType(?string $recording_type): static + { + if (is_null($recording_type)) { + throw new InvalidArgumentException('non-nullable recording_type cannot be null'); + } + $allowedValues = self::getRecordingTypeAllowableValues(); + if (!in_array($recording_type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'recording_type', must be one of '%s'", + $recording_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['recording_type'] = $recording_type; + + return $this; + } + + /** + * Gets allow_metronome + * + * @return bool|null + */ + public function getAllowMetronome(): ?bool + { + return $this->container['allow_metronome']; + } + + /** + * Sets allow_metronome + * + * @param bool|null $allow_metronome For performance assignments: Enable students to use the metronome while they are recording, helping them stay in time. Only set when type is 'performance'. + * + * @return $this + */ + public function setAllowMetronome(?bool $allow_metronome): static + { + if (is_null($allow_metronome)) { + throw new InvalidArgumentException('non-nullable allow_metronome cannot be null'); + } + $this->container['allow_metronome'] = $allow_metronome; + + return $this; + } + + /** + * Gets allow_backing_track + * + * @return bool|null + */ + public function getAllowBackingTrack(): ?bool + { + return $this->container['allow_backing_track']; + } + + /** + * Sets allow_backing_track + * + * @param bool|null $allow_backing_track For performance assignments: Enable students to listen to the accompaniment without their instrument part while they are playing. Only set when type is 'performance'. + * + * @return $this + */ + public function setAllowBackingTrack(?bool $allow_backing_track): static + { + if (is_null($allow_backing_track)) { + throw new InvalidArgumentException('non-nullable allow_backing_track cannot be null'); + } + $this->container['allow_backing_track'] = $allow_backing_track; + + return $this; + } + + /** + * Gets allow_speed_change + * + * @return bool|null + */ + public function getAllowSpeedChange(): ?bool + { + return $this->container['allow_speed_change']; + } + + /** + * Sets allow_speed_change + * + * @param bool|null $allow_speed_change For performance assignments: whether students can adjust the playback speed of the score during recording. * `true`: Students can change the tempo/speed during practice and recording * `false`: Tempo is fixed to the original score tempo Only set when type is 'performance'. + * + * @return $this + */ + public function setAllowSpeedChange(?bool $allow_speed_change): static + { + if (is_null($allow_speed_change)) { + throw new InvalidArgumentException('non-nullable allow_speed_change cannot be null'); + } + $this->container['allow_speed_change'] = $allow_speed_change; + + return $this; + } + + /** + * Gets free_record + * + * @return bool|null + */ + public function getFreeRecord(): ?bool + { + return $this->container['free_record']; + } + + /** + * Sets free_record + * + * @param bool|null $free_record For performance assignments: \"Free Record\" mode. When `true`, no score is attached to the assignment. Students freely record a varied repertoire or an ensemble performance without being constrained by a single score's structure or duration, and all score-dependent options (playback, metronome, backtracking, speed control) are hidden. Only set when type is 'performance'. + * + * @return $this + */ + public function setFreeRecord(?bool $free_record): static + { + if (is_null($free_record)) { + throw new InvalidArgumentException('non-nullable free_record cannot be null'); + } + $this->container['free_record'] = $free_record; + + return $this; + } + + /** + * Gets resource + * + * @return string|null + */ + public function getResource(): ?string + { + return $this->container['resource']; + } + + /** + * Sets resource + * + * @param string|null $resource If this assignment is stored as a resource in the Flat for Education Resource Library, the unique identifier of the resource. + * + * @return $this + */ + public function setResource(?string $resource): static + { + if (is_null($resource)) { + throw new InvalidArgumentException('non-nullable resource cannot be null'); + } + $this->container['resource'] = $resource; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AssignmentCopyToClass.php b/src/Model/AssignmentCopyToClass.php new file mode 100644 index 0000000..d5c8f3c --- /dev/null +++ b/src/Model/AssignmentCopyToClass.php @@ -0,0 +1,456 @@ + + */ +class AssignmentCopyToClass implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'AssignmentCopyToClass'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'classroom' => 'string', + 'assignment' => 'string', + 'scheduled_date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'classroom' => null, + 'assignment' => null, + 'scheduled_date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'classroom' => false, + 'assignment' => false, + 'scheduled_date' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'classroom' => 'classroom', + 'assignment' => 'assignment', + 'scheduled_date' => 'scheduledDate' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'classroom' => 'setClassroom', + 'assignment' => 'setAssignment', + 'scheduled_date' => 'setScheduledDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'classroom' => 'getClassroom', + 'assignment' => 'getAssignment', + 'scheduled_date' => 'getScheduledDate' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('classroom', $data ?? [], null); + $this->setIfExists('assignment', $data ?? [], null); + $this->setIfExists('scheduled_date', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['classroom'] === null) { + $invalidProperties[] = "'classroom' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets classroom + * + * @return string + */ + public function getClassroom(): string + { + return $this->container['classroom']; + } + + /** + * Sets classroom + * + * @param string $classroom The destination classroom where the assignment will be copied + * + * @return $this + */ + public function setClassroom(string $classroom): static + { + if (is_null($classroom)) { + throw new InvalidArgumentException('non-nullable classroom cannot be null'); + } + $this->container['classroom'] = $classroom; + + return $this; + } + + /** + * Gets assignment + * + * @return string|null + */ + public function getAssignment(): ?string + { + return $this->container['assignment']; + } + + /** + * Sets assignment + * + * @param string|null $assignment An optional destination assignment where the original assignement will be copied. Must be a draft. + * + * @return $this + */ + public function setAssignment(?string $assignment): static + { + if (is_null($assignment)) { + throw new InvalidArgumentException('non-nullable assignment cannot be null'); + } + $this->container['assignment'] = $assignment; + + return $this; + } + + /** + * Gets scheduled_date + * + * @return \DateTime|null + */ + public function getScheduledDate(): ?\DateTime + { + return $this->container['scheduled_date']; + } + + /** + * Sets scheduled_date + * + * @param \DateTime|null $scheduled_date The publication (scheduled) date of the assignment. If this one is specified, the assignment will only be listed to the teachers of the class. Alternatively the existing `scheduledDate` from the copied assignment will be used. + * + * @return $this + */ + public function setScheduledDate(?\DateTime $scheduled_date): static + { + if (is_null($scheduled_date)) { + throw new InvalidArgumentException('non-nullable scheduled_date cannot be null'); + } + $this->container['scheduled_date'] = $scheduled_date; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AssignmentCopyToResourceLibrary.php b/src/Model/AssignmentCopyToResourceLibrary.php new file mode 100644 index 0000000..35bb342 --- /dev/null +++ b/src/Model/AssignmentCopyToResourceLibrary.php @@ -0,0 +1,422 @@ + + */ +class AssignmentCopyToResourceLibrary implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'AssignmentCopyToResourceLibrary'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'library_parent' => 'string', + 'verify_if_not_already_in_resource_library' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'library_parent' => null, + 'verify_if_not_already_in_resource_library' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'library_parent' => false, + 'verify_if_not_already_in_resource_library' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'library_parent' => 'libraryParent', + 'verify_if_not_already_in_resource_library' => 'verifyIfNotAlreadyInResourceLibrary' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'library_parent' => 'setLibraryParent', + 'verify_if_not_already_in_resource_library' => 'setVerifyIfNotAlreadyInResourceLibrary' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'library_parent' => 'getLibraryParent', + 'verify_if_not_already_in_resource_library' => 'getVerifyIfNotAlreadyInResourceLibrary' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('library_parent', $data ?? [], null); + $this->setIfExists('verify_if_not_already_in_resource_library', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['library_parent'] === null) { + $invalidProperties[] = "'library_parent' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets library_parent + * + * @return string + */ + public function getLibraryParent(): string + { + return $this->container['library_parent']; + } + + /** + * Sets library_parent + * + * @param string $library_parent Identifier of the parent resource where the new one will created, e.g. a folder id or `root` + * + * @return $this + */ + public function setLibraryParent(string $library_parent): static + { + if (is_null($library_parent)) { + throw new InvalidArgumentException('non-nullable library_parent cannot be null'); + } + $this->container['library_parent'] = $library_parent; + + return $this; + } + + /** + * Gets verify_if_not_already_in_resource_library + * + * @return bool|null + */ + public function getVerifyIfNotAlreadyInResourceLibrary(): ?bool + { + return $this->container['verify_if_not_already_in_resource_library']; + } + + /** + * Sets verify_if_not_already_in_resource_library + * + * @param bool|null $verify_if_not_already_in_resource_library Option to check if the assignment is already in Resource Library + * + * @return $this + */ + public function setVerifyIfNotAlreadyInResourceLibrary(?bool $verify_if_not_already_in_resource_library): static + { + if (is_null($verify_if_not_already_in_resource_library)) { + throw new InvalidArgumentException('non-nullable verify_if_not_already_in_resource_library cannot be null'); + } + $this->container['verify_if_not_already_in_resource_library'] = $verify_if_not_already_in_resource_library; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AssignmentGroup.php b/src/Model/AssignmentGroup.php new file mode 100644 index 0000000..3db3ba7 --- /dev/null +++ b/src/Model/AssignmentGroup.php @@ -0,0 +1,496 @@ + + */ +class AssignmentGroup implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'AssignmentGroup'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'parent' => 'string', + 'members' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'parent' => null, + 'members' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'parent' => false, + 'members' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'parent' => 'parent', + 'members' => 'members' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'parent' => 'setParent', + 'members' => 'setMembers' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'parent' => 'getParent', + 'members' => 'getMembers' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('parent', $data ?? [], null); + $this->setIfExists('members', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['members'] === null) { + $invalidProperties[] = "'members' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The unique identifier of the group + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName(): string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name The display name of the group + * + * @return $this + */ + public function setName(string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets parent + * + * @return string|null + */ + public function getParent(): ?string + { + return $this->container['parent']; + } + + /** + * Sets parent + * + * @param string|null $parent The unique identifier of the parent class group. Only available for groups of type 'assignmentStudentsSubGroup'. May be null if the parent class group was deleted. + * + * @return $this + */ + public function setParent(?string $parent): static + { + if (is_null($parent)) { + throw new InvalidArgumentException('non-nullable parent cannot be null'); + } + $this->container['parent'] = $parent; + + return $this; + } + + /** + * Gets members + * + * @return string[] + */ + public function getMembers(): array + { + return $this->container['members']; + } + + /** + * Sets members + * + * @param string[] $members Array of user IDs that are members of this group + * + * @return $this + */ + public function setMembers(array $members): static + { + if (is_null($members)) { + throw new InvalidArgumentException('non-nullable members cannot be null'); + } + $this->container['members'] = $members; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AssignmentSubmission.php b/src/Model/AssignmentSubmission.php new file mode 100644 index 0000000..af7eedf --- /dev/null +++ b/src/Model/AssignmentSubmission.php @@ -0,0 +1,1038 @@ + + */ +class AssignmentSubmission implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'AssignmentSubmission'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'state' => '\Flat\APIClient\Model\AssignmentSubmissionState', + 'classroom' => 'string', + 'assignment' => 'string', + 'creator' => 'string', + 'creation_date' => 'string', + 'attachments' => '\Flat\APIClient\Model\MediaAttachment[]', + 'submission_date' => 'string', + 'return_date' => 'string', + 'return_creator' => 'string', + 'grade' => 'float', + 'draft_grade' => 'float', + 'max_points' => 'float', + 'exercises_ids' => 'string[]', + 'playback' => '\Flat\APIClient\Model\AssignmentSubmissionPlayback[]', + 'comments' => '\Flat\APIClient\Model\AssignmentSubmissionComments', + 'google_classroom' => '\Flat\APIClient\Model\GoogleClassroomSubmission', + 'microsoft_graph' => '\Flat\APIClient\Model\MicrosoftGraphSubmission', + 'lti' => '\Flat\APIClient\Model\AssignmentSubmissionLti' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'state' => null, + 'classroom' => null, + 'assignment' => null, + 'creator' => null, + 'creation_date' => null, + 'attachments' => null, + 'submission_date' => null, + 'return_date' => null, + 'return_creator' => null, + 'grade' => null, + 'draft_grade' => null, + 'max_points' => null, + 'exercises_ids' => null, + 'playback' => null, + 'comments' => null, + 'google_classroom' => null, + 'microsoft_graph' => null, + 'lti' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'state' => false, + 'classroom' => false, + 'assignment' => false, + 'creator' => false, + 'creation_date' => false, + 'attachments' => false, + 'submission_date' => false, + 'return_date' => false, + 'return_creator' => false, + 'grade' => true, + 'draft_grade' => true, + 'max_points' => false, + 'exercises_ids' => false, + 'playback' => false, + 'comments' => false, + 'google_classroom' => false, + 'microsoft_graph' => false, + 'lti' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'state' => 'state', + 'classroom' => 'classroom', + 'assignment' => 'assignment', + 'creator' => 'creator', + 'creation_date' => 'creationDate', + 'attachments' => 'attachments', + 'submission_date' => 'submissionDate', + 'return_date' => 'returnDate', + 'return_creator' => 'returnCreator', + 'grade' => 'grade', + 'draft_grade' => 'draftGrade', + 'max_points' => 'maxPoints', + 'exercises_ids' => 'exercisesIds', + 'playback' => 'playback', + 'comments' => 'comments', + 'google_classroom' => 'googleClassroom', + 'microsoft_graph' => 'microsoftGraph', + 'lti' => 'lti' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'state' => 'setState', + 'classroom' => 'setClassroom', + 'assignment' => 'setAssignment', + 'creator' => 'setCreator', + 'creation_date' => 'setCreationDate', + 'attachments' => 'setAttachments', + 'submission_date' => 'setSubmissionDate', + 'return_date' => 'setReturnDate', + 'return_creator' => 'setReturnCreator', + 'grade' => 'setGrade', + 'draft_grade' => 'setDraftGrade', + 'max_points' => 'setMaxPoints', + 'exercises_ids' => 'setExercisesIds', + 'playback' => 'setPlayback', + 'comments' => 'setComments', + 'google_classroom' => 'setGoogleClassroom', + 'microsoft_graph' => 'setMicrosoftGraph', + 'lti' => 'setLti' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'state' => 'getState', + 'classroom' => 'getClassroom', + 'assignment' => 'getAssignment', + 'creator' => 'getCreator', + 'creation_date' => 'getCreationDate', + 'attachments' => 'getAttachments', + 'submission_date' => 'getSubmissionDate', + 'return_date' => 'getReturnDate', + 'return_creator' => 'getReturnCreator', + 'grade' => 'getGrade', + 'draft_grade' => 'getDraftGrade', + 'max_points' => 'getMaxPoints', + 'exercises_ids' => 'getExercisesIds', + 'playback' => 'getPlayback', + 'comments' => 'getComments', + 'google_classroom' => 'getGoogleClassroom', + 'microsoft_graph' => 'getMicrosoftGraph', + 'lti' => 'getLti' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('classroom', $data ?? [], null); + $this->setIfExists('assignment', $data ?? [], null); + $this->setIfExists('creator', $data ?? [], null); + $this->setIfExists('creation_date', $data ?? [], null); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('submission_date', $data ?? [], null); + $this->setIfExists('return_date', $data ?? [], null); + $this->setIfExists('return_creator', $data ?? [], null); + $this->setIfExists('grade', $data ?? [], null); + $this->setIfExists('draft_grade', $data ?? [], null); + $this->setIfExists('max_points', $data ?? [], null); + $this->setIfExists('exercises_ids', $data ?? [], null); + $this->setIfExists('playback', $data ?? [], null); + $this->setIfExists('comments', $data ?? [], null); + $this->setIfExists('google_classroom', $data ?? [], null); + $this->setIfExists('microsoft_graph', $data ?? [], null); + $this->setIfExists('lti', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['state'] === null) { + $invalidProperties[] = "'state' can't be null"; + } + if ($this->container['classroom'] === null) { + $invalidProperties[] = "'classroom' can't be null"; + } + if ($this->container['assignment'] === null) { + $invalidProperties[] = "'assignment' can't be null"; + } + if ($this->container['creator'] === null) { + $invalidProperties[] = "'creator' can't be null"; + } + if ($this->container['creation_date'] === null) { + $invalidProperties[] = "'creation_date' can't be null"; + } + if ($this->container['attachments'] === null) { + $invalidProperties[] = "'attachments' can't be null"; + } + if ($this->container['playback'] === null) { + $invalidProperties[] = "'playback' can't be null"; + } + if ($this->container['comments'] === null) { + $invalidProperties[] = "'comments' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Unique identifier of the submission + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets state + * + * @return \Flat\APIClient\Model\AssignmentSubmissionState + */ + public function getState(): \Flat\APIClient\Model\AssignmentSubmissionState + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param \Flat\APIClient\Model\AssignmentSubmissionState $state state + * + * @return $this + */ + public function setState(\Flat\APIClient\Model\AssignmentSubmissionState $state): static + { + if (is_null($state)) { + throw new InvalidArgumentException('non-nullable state cannot be null'); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets classroom + * + * @return string + */ + public function getClassroom(): string + { + return $this->container['classroom']; + } + + /** + * Sets classroom + * + * @param string $classroom Unique identifier of the classroom where the assignment was posted + * + * @return $this + */ + public function setClassroom(string $classroom): static + { + if (is_null($classroom)) { + throw new InvalidArgumentException('non-nullable classroom cannot be null'); + } + $this->container['classroom'] = $classroom; + + return $this; + } + + /** + * Gets assignment + * + * @return string + */ + public function getAssignment(): string + { + return $this->container['assignment']; + } + + /** + * Sets assignment + * + * @param string $assignment Unique identifier of the assignment + * + * @return $this + */ + public function setAssignment(string $assignment): static + { + if (is_null($assignment)) { + throw new InvalidArgumentException('non-nullable assignment cannot be null'); + } + $this->container['assignment'] = $assignment; + + return $this; + } + + /** + * Gets creator + * + * @return string + */ + public function getCreator(): string + { + return $this->container['creator']; + } + + /** + * Sets creator + * + * @param string $creator The User identifier of the student who created the submission + * + * @return $this + */ + public function setCreator(string $creator): static + { + if (is_null($creator)) { + throw new InvalidArgumentException('non-nullable creator cannot be null'); + } + $this->container['creator'] = $creator; + + return $this; + } + + /** + * Gets creation_date + * + * @return string + */ + public function getCreationDate(): string + { + return $this->container['creation_date']; + } + + /** + * Sets creation_date + * + * @param string $creation_date The date when the submission was created + * + * @return $this + */ + public function setCreationDate(string $creation_date): static + { + if (is_null($creation_date)) { + throw new InvalidArgumentException('non-nullable creation_date cannot be null'); + } + $this->container['creation_date'] = $creation_date; + + return $this; + } + + /** + * Gets attachments + * + * @return \Flat\APIClient\Model\MediaAttachment[] + */ + public function getAttachments(): array + { + return $this->container['attachments']; + } + + /** + * Sets attachments + * + * @param \Flat\APIClient\Model\MediaAttachment[] $attachments attachments + * + * @return $this + */ + public function setAttachments(array $attachments): static + { + if (is_null($attachments)) { + throw new InvalidArgumentException('non-nullable attachments cannot be null'); + } + $this->container['attachments'] = $attachments; + + return $this; + } + + /** + * Gets submission_date + * + * @return string|null + */ + public function getSubmissionDate(): ?string + { + return $this->container['submission_date']; + } + + /** + * Sets submission_date + * + * @param string|null $submission_date The date when the student submitted their work + * + * @return $this + */ + public function setSubmissionDate(?string $submission_date): static + { + if (is_null($submission_date)) { + throw new InvalidArgumentException('non-nullable submission_date cannot be null'); + } + $this->container['submission_date'] = $submission_date; + + return $this; + } + + /** + * Gets return_date + * + * @return string|null + */ + public function getReturnDate(): ?string + { + return $this->container['return_date']; + } + + /** + * Sets return_date + * + * @param string|null $return_date The date when the teacher returned the work + * + * @return $this + */ + public function setReturnDate(?string $return_date): static + { + if (is_null($return_date)) { + throw new InvalidArgumentException('non-nullable return_date cannot be null'); + } + $this->container['return_date'] = $return_date; + + return $this; + } + + /** + * Gets return_creator + * + * @return string|null + */ + public function getReturnCreator(): ?string + { + return $this->container['return_creator']; + } + + /** + * Sets return_creator + * + * @param string|null $return_creator The User unique identifier of the teacher who returned the submission + * + * @return $this + */ + public function setReturnCreator(?string $return_creator): static + { + if (is_null($return_creator)) { + throw new InvalidArgumentException('non-nullable return_creator cannot be null'); + } + $this->container['return_creator'] = $return_creator; + + return $this; + } + + /** + * Gets grade + * + * @return float|null + */ + public function getGrade(): ?float + { + return $this->container['grade']; + } + + /** + * Sets grade + * + * @param float|null $grade Optional grade. If unset, no grade was set. + * + * @return $this + */ + public function setGrade(?float $grade): static + { + if (is_null($grade)) { + array_push($this->openAPINullablesSetToNull, 'grade'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('grade', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['grade'] = $grade; + + return $this; + } + + /** + * Gets draft_grade + * + * @return float|null + */ + public function getDraftGrade(): ?float + { + return $this->container['draft_grade']; + } + + /** + * Sets draft_grade + * + * @param float|null $draft_grade Optional grade. If unset, no grade was set. This value is only visible by the teacher, and we will be set to `grade` once the teacher returns the submission + * + * @return $this + */ + public function setDraftGrade(?float $draft_grade): static + { + if (is_null($draft_grade)) { + array_push($this->openAPINullablesSetToNull, 'draft_grade'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('draft_grade', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['draft_grade'] = $draft_grade; + + return $this; + } + + /** + * Gets max_points + * + * @return float|null + */ + public function getMaxPoints(): ?float + { + return $this->container['max_points']; + } + + /** + * Sets max_points + * + * @param float|null $max_points Optional max points for the grade. If set, a corresponding `draftGrade` or `grade` will be set. + * + * @return $this + */ + public function setMaxPoints(?float $max_points): static + { + if (is_null($max_points)) { + throw new InvalidArgumentException('non-nullable max_points cannot be null'); + } + $this->container['max_points'] = $max_points; + + return $this; + } + + /** + * Gets exercises_ids + * + * @return string[]|null + */ + public function getExercisesIds(): ?array + { + return $this->container['exercises_ids']; + } + + /** + * Sets exercises_ids + * + * @param string[]|null $exercises_ids The ids of exercises when they need to be in a specific order + * + * @return $this + */ + public function setExercisesIds(?array $exercises_ids): static + { + if (is_null($exercises_ids)) { + throw new InvalidArgumentException('non-nullable exercises_ids cannot be null'); + } + $this->container['exercises_ids'] = $exercises_ids; + + return $this; + } + + /** + * Gets playback + * + * @return \Flat\APIClient\Model\AssignmentSubmissionPlayback[] + */ + public function getPlayback(): array + { + return $this->container['playback']; + } + + /** + * Sets playback + * + * @param \Flat\APIClient\Model\AssignmentSubmissionPlayback[] $playback playback + * + * @return $this + */ + public function setPlayback(array $playback): static + { + if (is_null($playback)) { + throw new InvalidArgumentException('non-nullable playback cannot be null'); + } + $this->container['playback'] = $playback; + + return $this; + } + + /** + * Gets comments + * + * @return \Flat\APIClient\Model\AssignmentSubmissionComments + */ + public function getComments(): \Flat\APIClient\Model\AssignmentSubmissionComments + { + return $this->container['comments']; + } + + /** + * Sets comments + * + * @param \Flat\APIClient\Model\AssignmentSubmissionComments $comments comments + * + * @return $this + */ + public function setComments(\Flat\APIClient\Model\AssignmentSubmissionComments $comments): static + { + if (is_null($comments)) { + throw new InvalidArgumentException('non-nullable comments cannot be null'); + } + $this->container['comments'] = $comments; + + return $this; + } + + /** + * Gets google_classroom + * + * @return \Flat\APIClient\Model\GoogleClassroomSubmission|null + */ + public function getGoogleClassroom(): ?\Flat\APIClient\Model\GoogleClassroomSubmission + { + return $this->container['google_classroom']; + } + + /** + * Sets google_classroom + * + * @param \Flat\APIClient\Model\GoogleClassroomSubmission|null $google_classroom google_classroom + * + * @return $this + */ + public function setGoogleClassroom(?\Flat\APIClient\Model\GoogleClassroomSubmission $google_classroom): static + { + if (is_null($google_classroom)) { + throw new InvalidArgumentException('non-nullable google_classroom cannot be null'); + } + $this->container['google_classroom'] = $google_classroom; + + return $this; + } + + /** + * Gets microsoft_graph + * + * @return \Flat\APIClient\Model\MicrosoftGraphSubmission|null + */ + public function getMicrosoftGraph(): ?\Flat\APIClient\Model\MicrosoftGraphSubmission + { + return $this->container['microsoft_graph']; + } + + /** + * Sets microsoft_graph + * + * @param \Flat\APIClient\Model\MicrosoftGraphSubmission|null $microsoft_graph microsoft_graph + * + * @return $this + */ + public function setMicrosoftGraph(?\Flat\APIClient\Model\MicrosoftGraphSubmission $microsoft_graph): static + { + if (is_null($microsoft_graph)) { + throw new InvalidArgumentException('non-nullable microsoft_graph cannot be null'); + } + $this->container['microsoft_graph'] = $microsoft_graph; + + return $this; + } + + /** + * Gets lti + * + * @return \Flat\APIClient\Model\AssignmentSubmissionLti|null + */ + public function getLti(): ?\Flat\APIClient\Model\AssignmentSubmissionLti + { + return $this->container['lti']; + } + + /** + * Sets lti + * + * @param \Flat\APIClient\Model\AssignmentSubmissionLti|null $lti lti + * + * @return $this + */ + public function setLti(?\Flat\APIClient\Model\AssignmentSubmissionLti $lti): static + { + if (is_null($lti)) { + throw new InvalidArgumentException('non-nullable lti cannot be null'); + } + $this->container['lti'] = $lti; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AssignmentSubmissionComment.php b/src/Model/AssignmentSubmissionComment.php new file mode 100644 index 0000000..57aa765 --- /dev/null +++ b/src/Model/AssignmentSubmissionComment.php @@ -0,0 +1,589 @@ + + */ +class AssignmentSubmissionComment implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'AssignmentSubmissionComment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'user' => 'string', + 'submission' => 'string', + 'date' => '\DateTime', + 'modification_date' => '\DateTime', + 'comment' => 'string', + 'unread' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'user' => null, + 'submission' => null, + 'date' => 'date-time', + 'modification_date' => 'date-time', + 'comment' => null, + 'unread' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user' => false, + 'submission' => false, + 'date' => false, + 'modification_date' => false, + 'comment' => false, + 'unread' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'user' => 'user', + 'submission' => 'submission', + 'date' => 'date', + 'modification_date' => 'modificationDate', + 'comment' => 'comment', + 'unread' => 'unread' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'user' => 'setUser', + 'submission' => 'setSubmission', + 'date' => 'setDate', + 'modification_date' => 'setModificationDate', + 'comment' => 'setComment', + 'unread' => 'setUnread' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'user' => 'getUser', + 'submission' => 'getSubmission', + 'date' => 'getDate', + 'modification_date' => 'getModificationDate', + 'comment' => 'getComment', + 'unread' => 'getUnread' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user', $data ?? [], null); + $this->setIfExists('submission', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('modification_date', $data ?? [], null); + $this->setIfExists('comment', $data ?? [], null); + $this->setIfExists('unread', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The comment unique identifier + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user + * + * @return string|null + */ + public function getUser(): ?string + { + return $this->container['user']; + } + + /** + * Sets user + * + * @param string|null $user The author unique identifier + * + * @return $this + */ + public function setUser(?string $user): static + { + if (is_null($user)) { + throw new InvalidArgumentException('non-nullable user cannot be null'); + } + $this->container['user'] = $user; + + return $this; + } + + /** + * Gets submission + * + * @return string|null + */ + public function getSubmission(): ?string + { + return $this->container['submission']; + } + + /** + * Sets submission + * + * @param string|null $submission The submission unique identifier + * + * @return $this + */ + public function setSubmission(?string $submission): static + { + if (is_null($submission)) { + throw new InvalidArgumentException('non-nullable submission cannot be null'); + } + $this->container['submission'] = $submission; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate(): ?\DateTime + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date The date when the comment was posted + * + * @return $this + */ + public function setDate(?\DateTime $date): static + { + if (is_null($date)) { + throw new InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets modification_date + * + * @return \DateTime|null + */ + public function getModificationDate(): ?\DateTime + { + return $this->container['modification_date']; + } + + /** + * Sets modification_date + * + * @param \DateTime|null $modification_date The date of the last comment modification + * + * @return $this + */ + public function setModificationDate(?\DateTime $modification_date): static + { + if (is_null($modification_date)) { + throw new InvalidArgumentException('non-nullable modification_date cannot be null'); + } + $this->container['modification_date'] = $modification_date; + + return $this; + } + + /** + * Gets comment + * + * @return string|null + */ + public function getComment(): ?string + { + return $this->container['comment']; + } + + /** + * Sets comment + * + * @param string|null $comment The comment text + * + * @return $this + */ + public function setComment(?string $comment): static + { + if (is_null($comment)) { + throw new InvalidArgumentException('non-nullable comment cannot be null'); + } + $this->container['comment'] = $comment; + + return $this; + } + + /** + * Gets unread + * + * @return bool|null + */ + public function getUnread(): ?bool + { + return $this->container['unread']; + } + + /** + * Sets unread + * + * @param bool|null $unread True if the comment is unread by the current user + * + * @return $this + */ + public function setUnread(?bool $unread): static + { + if (is_null($unread)) { + throw new InvalidArgumentException('non-nullable unread cannot be null'); + } + $this->container['unread'] = $unread; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AssignmentSubmissionCommentCreation.php b/src/Model/AssignmentSubmissionCommentCreation.php new file mode 100644 index 0000000..eddf745 --- /dev/null +++ b/src/Model/AssignmentSubmissionCommentCreation.php @@ -0,0 +1,388 @@ + + */ +class AssignmentSubmissionCommentCreation implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'AssignmentSubmissionCommentCreation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'comment' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'comment' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'comment' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'comment' => 'comment' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'comment' => 'setComment' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'comment' => 'getComment' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('comment', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['comment'] === null) { + $invalidProperties[] = "'comment' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets comment + * + * @return string + */ + public function getComment(): string + { + return $this->container['comment']; + } + + /** + * Sets comment + * + * @param string $comment The comment text + * + * @return $this + */ + public function setComment(string $comment): static + { + if (is_null($comment)) { + throw new InvalidArgumentException('non-nullable comment cannot be null'); + } + $this->container['comment'] = $comment; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AssignmentSubmissionComments.php b/src/Model/AssignmentSubmissionComments.php new file mode 100644 index 0000000..41b2fe3 --- /dev/null +++ b/src/Model/AssignmentSubmissionComments.php @@ -0,0 +1,418 @@ + + */ +class AssignmentSubmissionComments implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'AssignmentSubmission_comments'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'total' => 'float', + 'unread' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'total' => null, + 'unread' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'total' => false, + 'unread' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'total' => 'total', + 'unread' => 'unread' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'total' => 'setTotal', + 'unread' => 'setUnread' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'total' => 'getTotal', + 'unread' => 'getUnread' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('unread', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets total + * + * @return float|null + */ + public function getTotal(): ?float + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param float|null $total The total number of comments added to the submission + * + * @return $this + */ + public function setTotal(?float $total): static + { + if (is_null($total)) { + throw new InvalidArgumentException('non-nullable total cannot be null'); + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets unread + * + * @return float|null + */ + public function getUnread(): ?float + { + return $this->container['unread']; + } + + /** + * Sets unread + * + * @param float|null $unread The number of unread comments for the current user + * + * @return $this + */ + public function setUnread(?float $unread): static + { + if (is_null($unread)) { + throw new InvalidArgumentException('non-nullable unread cannot be null'); + } + $this->container['unread'] = $unread; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AssignmentSubmissionHistory.php b/src/Model/AssignmentSubmissionHistory.php new file mode 100644 index 0000000..31a4bb9 --- /dev/null +++ b/src/Model/AssignmentSubmissionHistory.php @@ -0,0 +1,835 @@ + + */ +class AssignmentSubmissionHistory implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'AssignmentSubmissionHistory'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'date' => '\DateTime', + 'classroom' => 'string', + 'assignment' => 'string', + 'submission' => 'string', + 'users' => 'string[]', + 'source' => 'string', + 'state' => '\Flat\APIClient\Model\AssignmentSubmissionHistoryState', + 'draft_grade' => 'float', + 'grade' => 'float', + 'max_points' => 'float', + 'comment' => 'string', + 'due_date' => '\DateTime', + 'attachment' => '\Flat\APIClient\Model\AssignmentSubmissionHistoryAttachment' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'date' => 'date-time', + 'classroom' => null, + 'assignment' => null, + 'submission' => null, + 'users' => null, + 'source' => null, + 'state' => null, + 'draft_grade' => null, + 'grade' => null, + 'max_points' => null, + 'comment' => null, + 'due_date' => 'date-time', + 'attachment' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'date' => false, + 'classroom' => false, + 'assignment' => false, + 'submission' => false, + 'users' => false, + 'source' => false, + 'state' => false, + 'draft_grade' => false, + 'grade' => false, + 'max_points' => false, + 'comment' => false, + 'due_date' => false, + 'attachment' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'date' => 'date', + 'classroom' => 'classroom', + 'assignment' => 'assignment', + 'submission' => 'submission', + 'users' => 'users', + 'source' => 'source', + 'state' => 'state', + 'draft_grade' => 'draftGrade', + 'grade' => 'grade', + 'max_points' => 'maxPoints', + 'comment' => 'comment', + 'due_date' => 'dueDate', + 'attachment' => 'attachment' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'date' => 'setDate', + 'classroom' => 'setClassroom', + 'assignment' => 'setAssignment', + 'submission' => 'setSubmission', + 'users' => 'setUsers', + 'source' => 'setSource', + 'state' => 'setState', + 'draft_grade' => 'setDraftGrade', + 'grade' => 'setGrade', + 'max_points' => 'setMaxPoints', + 'comment' => 'setComment', + 'due_date' => 'setDueDate', + 'attachment' => 'setAttachment' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'date' => 'getDate', + 'classroom' => 'getClassroom', + 'assignment' => 'getAssignment', + 'submission' => 'getSubmission', + 'users' => 'getUsers', + 'source' => 'getSource', + 'state' => 'getState', + 'draft_grade' => 'getDraftGrade', + 'grade' => 'getGrade', + 'max_points' => 'getMaxPoints', + 'comment' => 'getComment', + 'due_date' => 'getDueDate', + 'attachment' => 'getAttachment' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const SOURCE_LTI = 'lti'; + public const SOURCE_GOOGLE_CLASSROOM = 'googleClassroom'; + public const SOURCE_MICROSOFT_GRAPH = 'microsoftGraph'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getSourceAllowableValues() + { + return [ + self::SOURCE_LTI, + self::SOURCE_GOOGLE_CLASSROOM, + self::SOURCE_MICROSOFT_GRAPH, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('classroom', $data ?? [], null); + $this->setIfExists('assignment', $data ?? [], null); + $this->setIfExists('submission', $data ?? [], null); + $this->setIfExists('users', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('draft_grade', $data ?? [], null); + $this->setIfExists('grade', $data ?? [], null); + $this->setIfExists('max_points', $data ?? [], null); + $this->setIfExists('comment', $data ?? [], null); + $this->setIfExists('due_date', $data ?? [], null); + $this->setIfExists('attachment', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['date'] === null) { + $invalidProperties[] = "'date' can't be null"; + } + if ($this->container['users'] === null) { + $invalidProperties[] = "'users' can't be null"; + } + $allowedValues = self::getSourceAllowableValues(); + if (!is_null($this->container['source']) && !in_array($this->container['source'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'source', must be one of '%s'", + $this->container['source'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets date + * + * @return \DateTime + */ + public function getDate(): \DateTime + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime $date The date when the submission was changed + * + * @return $this + */ + public function setDate(\DateTime $date): static + { + if (is_null($date)) { + throw new InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets classroom + * + * @return string|null + */ + public function getClassroom(): ?string + { + return $this->container['classroom']; + } + + /** + * Sets classroom + * + * @param string|null $classroom The classroom unique identifier where the submission was changed + * + * @return $this + */ + public function setClassroom(?string $classroom): static + { + if (is_null($classroom)) { + throw new InvalidArgumentException('non-nullable classroom cannot be null'); + } + $this->container['classroom'] = $classroom; + + return $this; + } + + /** + * Gets assignment + * + * @return string|null + */ + public function getAssignment(): ?string + { + return $this->container['assignment']; + } + + /** + * Sets assignment + * + * @param string|null $assignment The assignment unique identifier where the submission was changed + * + * @return $this + */ + public function setAssignment(?string $assignment): static + { + if (is_null($assignment)) { + throw new InvalidArgumentException('non-nullable assignment cannot be null'); + } + $this->container['assignment'] = $assignment; + + return $this; + } + + /** + * Gets submission + * + * @return string|null + */ + public function getSubmission(): ?string + { + return $this->container['submission']; + } + + /** + * Sets submission + * + * @param string|null $submission The submission unique identifier + * + * @return $this + */ + public function setSubmission(?string $submission): static + { + if (is_null($submission)) { + throw new InvalidArgumentException('non-nullable submission cannot be null'); + } + $this->container['submission'] = $submission; + + return $this; + } + + /** + * Gets users + * + * @return string[] + */ + public function getUsers(): array + { + return $this->container['users']; + } + + /** + * Sets users + * + * @param string[] $users The user(s) unique identifier(s) who made the change + * + * @return $this + */ + public function setUsers(array $users): static + { + if (is_null($users)) { + throw new InvalidArgumentException('non-nullable users cannot be null'); + } + $this->container['users'] = $users; + + return $this; + } + + /** + * Gets source + * + * @return string|null + */ + public function getSource(): ?string + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param string|null $source The source of the change if the change was made by a third-party software + * + * @return $this + */ + public function setSource(?string $source): static + { + if (is_null($source)) { + throw new InvalidArgumentException('non-nullable source cannot be null'); + } + $allowedValues = self::getSourceAllowableValues(); + if (!in_array($source, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'source', must be one of '%s'", + $source, + implode("', '", $allowedValues) + ) + ); + } + $this->container['source'] = $source; + + return $this; + } + + /** + * Gets state + * + * @return \Flat\APIClient\Model\AssignmentSubmissionHistoryState|null + */ + public function getState(): ?\Flat\APIClient\Model\AssignmentSubmissionHistoryState + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param \Flat\APIClient\Model\AssignmentSubmissionHistoryState|null $state state + * + * @return $this + */ + public function setState(?\Flat\APIClient\Model\AssignmentSubmissionHistoryState $state): static + { + if (is_null($state)) { + throw new InvalidArgumentException('non-nullable state cannot be null'); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets draft_grade + * + * @return float|null + */ + public function getDraftGrade(): ?float + { + return $this->container['draft_grade']; + } + + /** + * Sets draft_grade + * + * @param float|null $draft_grade The numerator of the grade at this time in the submission grade history + * + * @return $this + */ + public function setDraftGrade(?float $draft_grade): static + { + if (is_null($draft_grade)) { + throw new InvalidArgumentException('non-nullable draft_grade cannot be null'); + } + $this->container['draft_grade'] = $draft_grade; + + return $this; + } + + /** + * Gets grade + * + * @return float|null + */ + public function getGrade(): ?float + { + return $this->container['grade']; + } + + /** + * Sets grade + * + * @param float|null $grade The numerator of the grade at this time in the submission grade history + * + * @return $this + */ + public function setGrade(?float $grade): static + { + if (is_null($grade)) { + throw new InvalidArgumentException('non-nullable grade cannot be null'); + } + $this->container['grade'] = $grade; + + return $this; + } + + /** + * Gets max_points + * + * @return float|null + */ + public function getMaxPoints(): ?float + { + return $this->container['max_points']; + } + + /** + * Sets max_points + * + * @param float|null $max_points The denominator of the grade at this time in the submission grade history + * + * @return $this + */ + public function setMaxPoints(?float $max_points): static + { + if (is_null($max_points)) { + throw new InvalidArgumentException('non-nullable max_points cannot be null'); + } + $this->container['max_points'] = $max_points; + + return $this; + } + + /** + * Gets comment + * + * @return string|null + */ + public function getComment(): ?string + { + return $this->container['comment']; + } + + /** + * Sets comment + * + * @param string|null $comment The comment that is made to this submission + * + * @return $this + */ + public function setComment(?string $comment): static + { + if (is_null($comment)) { + throw new InvalidArgumentException('non-nullable comment cannot be null'); + } + $this->container['comment'] = $comment; + + return $this; + } + + /** + * Gets due_date + * + * @return \DateTime|null + */ + public function getDueDate(): ?\DateTime + { + return $this->container['due_date']; + } + + /** + * Sets due_date + * + * @param \DateTime|null $due_date The due date of this assignment + * + * @return $this + */ + public function setDueDate(?\DateTime $due_date): static + { + if (is_null($due_date)) { + throw new InvalidArgumentException('non-nullable due_date cannot be null'); + } + $this->container['due_date'] = $due_date; + + return $this; + } + + /** + * Gets attachment + * + * @return \Flat\APIClient\Model\AssignmentSubmissionHistoryAttachment|null + */ + public function getAttachment(): ?\Flat\APIClient\Model\AssignmentSubmissionHistoryAttachment + { + return $this->container['attachment']; + } + + /** + * Sets attachment + * + * @param \Flat\APIClient\Model\AssignmentSubmissionHistoryAttachment|null $attachment attachment + * + * @return $this + */ + public function setAttachment(?\Flat\APIClient\Model\AssignmentSubmissionHistoryAttachment $attachment): static + { + if (is_null($attachment)) { + throw new InvalidArgumentException('non-nullable attachment cannot be null'); + } + $this->container['attachment'] = $attachment; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AssignmentSubmissionHistoryAttachment.php b/src/Model/AssignmentSubmissionHistoryAttachment.php new file mode 100644 index 0000000..770cc00 --- /dev/null +++ b/src/Model/AssignmentSubmissionHistoryAttachment.php @@ -0,0 +1,452 @@ + + */ +class AssignmentSubmissionHistoryAttachment implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'AssignmentSubmissionHistory_attachment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'score' => 'string', + 'revision' => 'string', + 'title' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'score' => null, + 'revision' => null, + 'title' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'score' => false, + 'revision' => false, + 'title' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'score' => 'score', + 'revision' => 'revision', + 'title' => 'title' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'score' => 'setScore', + 'revision' => 'setRevision', + 'title' => 'setTitle' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'score' => 'getScore', + 'revision' => 'getRevision', + 'title' => 'getTitle' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('score', $data ?? [], null); + $this->setIfExists('revision', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets score + * + * @return string|null + */ + public function getScore(): ?string + { + return $this->container['score']; + } + + /** + * Sets score + * + * @param string|null $score The score identifier that changed + * + * @return $this + */ + public function setScore(?string $score): static + { + if (is_null($score)) { + throw new InvalidArgumentException('non-nullable score cannot be null'); + } + $this->container['score'] = $score; + + return $this; + } + + /** + * Gets revision + * + * @return string|null + */ + public function getRevision(): ?string + { + return $this->container['revision']; + } + + /** + * Sets revision + * + * @param string|null $revision The revision identifier that changed + * + * @return $this + */ + public function setRevision(?string $revision): static + { + if (is_null($revision)) { + throw new InvalidArgumentException('non-nullable revision cannot be null'); + } + $this->container['revision'] = $revision; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle(): ?string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the score that changed + * + * @return $this + */ + public function setTitle(?string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AssignmentSubmissionHistoryState.php b/src/Model/AssignmentSubmissionHistoryState.php new file mode 100644 index 0000000..5f92898 --- /dev/null +++ b/src/Model/AssignmentSubmissionHistoryState.php @@ -0,0 +1,52 @@ + + */ +class AssignmentSubmissionLti implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'AssignmentSubmission_lti'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'grade_service' => 'string', + 'sourcedid' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'grade_service' => null, + 'sourcedid' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'grade_service' => false, + 'sourcedid' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'grade_service' => 'gradeService', + 'sourcedid' => 'sourcedid' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'grade_service' => 'setGradeService', + 'sourcedid' => 'setSourcedid' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'grade_service' => 'getGradeService', + 'sourcedid' => 'getSourcedid' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const GRADE_SERVICE_AGS2P0 = 'ags2p0'; + public const GRADE_SERVICE_OUTCOMES1P1 = 'outcomes1p1'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getGradeServiceAllowableValues() + { + return [ + self::GRADE_SERVICE_AGS2P0, + self::GRADE_SERVICE_OUTCOMES1P1, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('grade_service', $data ?? [], null); + $this->setIfExists('sourcedid', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['grade_service'] === null) { + $invalidProperties[] = "'grade_service' can't be null"; + } + $allowedValues = self::getGradeServiceAllowableValues(); + if (!is_null($this->container['grade_service']) && !in_array($this->container['grade_service'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'grade_service', must be one of '%s'", + $this->container['grade_service'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets grade_service + * + * @return string + */ + public function getGradeService(): string + { + return $this->container['grade_service']; + } + + /** + * Sets grade_service + * + * @param string $grade_service The kind of grading service available for this submission: - `ags2p0`: LTI 1.3 Assignment and Grade Services 2.0 - `outcomes1p1`: LTI 1.1 Outcomes 1.1 + * + * @return $this + */ + public function setGradeService(string $grade_service): static + { + if (is_null($grade_service)) { + throw new InvalidArgumentException('non-nullable grade_service cannot be null'); + } + $allowedValues = self::getGradeServiceAllowableValues(); + if (!in_array($grade_service, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'grade_service', must be one of '%s'", + $grade_service, + implode("', '", $allowedValues) + ) + ); + } + $this->container['grade_service'] = $grade_service; + + return $this; + } + + /** + * Gets sourcedid + * + * @return string|null + */ + public function getSourcedid(): ?string + { + return $this->container['sourcedid']; + } + + /** + * Sets sourcedid + * + * @param string|null $sourcedid The sourcedid of the LTI submission when using LTI Outcomes + * + * @return $this + */ + public function setSourcedid(?string $sourcedid): static + { + if (is_null($sourcedid)) { + throw new InvalidArgumentException('non-nullable sourcedid cannot be null'); + } + $this->container['sourcedid'] = $sourcedid; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AssignmentSubmissionPlayback.php b/src/Model/AssignmentSubmissionPlayback.php new file mode 100644 index 0000000..74df18e --- /dev/null +++ b/src/Model/AssignmentSubmissionPlayback.php @@ -0,0 +1,425 @@ + + */ +class AssignmentSubmissionPlayback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'AssignmentSubmissionPlayback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'score' => 'string', + 'nb_play_attempt' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'score' => null, + 'nb_play_attempt' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'score' => false, + 'nb_play_attempt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'score' => 'score', + 'nb_play_attempt' => 'nbPlayAttempt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'score' => 'setScore', + 'nb_play_attempt' => 'setNbPlayAttempt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'score' => 'getScore', + 'nb_play_attempt' => 'getNbPlayAttempt' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('score', $data ?? [], null); + $this->setIfExists('nb_play_attempt', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['score'] === null) { + $invalidProperties[] = "'score' can't be null"; + } + if ($this->container['nb_play_attempt'] === null) { + $invalidProperties[] = "'nb_play_attempt' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets score + * + * @return string + */ + public function getScore(): string + { + return $this->container['score']; + } + + /** + * Sets score + * + * @param string $score The score unique identifier + * + * @return $this + */ + public function setScore(string $score): static + { + if (is_null($score)) { + throw new InvalidArgumentException('non-nullable score cannot be null'); + } + $this->container['score'] = $score; + + return $this; + } + + /** + * Gets nb_play_attempt + * + * @return float + */ + public function getNbPlayAttempt(): float + { + return $this->container['nb_play_attempt']; + } + + /** + * Sets nb_play_attempt + * + * @param float $nb_play_attempt Number of times the score was played + * + * @return $this + */ + public function setNbPlayAttempt(float $nb_play_attempt): static + { + if (is_null($nb_play_attempt)) { + throw new InvalidArgumentException('non-nullable nb_play_attempt cannot be null'); + } + $this->container['nb_play_attempt'] = $nb_play_attempt; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AssignmentSubmissionState.php b/src/Model/AssignmentSubmissionState.php new file mode 100644 index 0000000..2a11259 --- /dev/null +++ b/src/Model/AssignmentSubmissionState.php @@ -0,0 +1,50 @@ + + */ +class AssignmentSubmissionUpdate implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'AssignmentSubmissionUpdate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'attachments' => '\Flat\APIClient\Model\ClassAttachmentCreation[]', + 'playback' => '\Flat\APIClient\Model\AssignmentSubmissionPlayback[]', + 'submit' => 'bool', + 'draft_grade' => 'float', + 'grade' => 'float', + 'exercises_ids' => 'string[]', + 'return' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'attachments' => null, + 'playback' => null, + 'submit' => null, + 'draft_grade' => null, + 'grade' => null, + 'exercises_ids' => null, + 'return' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'attachments' => false, + 'playback' => false, + 'submit' => false, + 'draft_grade' => true, + 'grade' => true, + 'exercises_ids' => true, + 'return' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'attachments' => 'attachments', + 'playback' => 'playback', + 'submit' => 'submit', + 'draft_grade' => 'draftGrade', + 'grade' => 'grade', + 'exercises_ids' => 'exercisesIds', + 'return' => 'return' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'attachments' => 'setAttachments', + 'playback' => 'setPlayback', + 'submit' => 'setSubmit', + 'draft_grade' => 'setDraftGrade', + 'grade' => 'setGrade', + 'exercises_ids' => 'setExercisesIds', + 'return' => 'setReturn' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'attachments' => 'getAttachments', + 'playback' => 'getPlayback', + 'submit' => 'getSubmit', + 'draft_grade' => 'getDraftGrade', + 'grade' => 'getGrade', + 'exercises_ids' => 'getExercisesIds', + 'return' => 'getReturn' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('playback', $data ?? [], null); + $this->setIfExists('submit', $data ?? [], null); + $this->setIfExists('draft_grade', $data ?? [], null); + $this->setIfExists('grade', $data ?? [], null); + $this->setIfExists('exercises_ids', $data ?? [], null); + $this->setIfExists('return', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['draft_grade']) && ($this->container['draft_grade'] > 10000)) { + $invalidProperties[] = "invalid value for 'draft_grade', must be smaller than or equal to 10000."; + } + + if (!is_null($this->container['draft_grade']) && ($this->container['draft_grade'] < 0)) { + $invalidProperties[] = "invalid value for 'draft_grade', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['grade']) && ($this->container['grade'] > 10000)) { + $invalidProperties[] = "invalid value for 'grade', must be smaller than or equal to 10000."; + } + + if (!is_null($this->container['grade']) && ($this->container['grade'] < 0)) { + $invalidProperties[] = "invalid value for 'grade', must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets attachments + * + * @return \Flat\APIClient\Model\ClassAttachmentCreation[]|null + */ + public function getAttachments(): ?array + { + return $this->container['attachments']; + } + + /** + * Sets attachments + * + * @param \Flat\APIClient\Model\ClassAttachmentCreation[]|null $attachments attachments + * + * @return $this + */ + public function setAttachments(?array $attachments): static + { + if (is_null($attachments)) { + throw new InvalidArgumentException('non-nullable attachments cannot be null'); + } + $this->container['attachments'] = $attachments; + + return $this; + } + + /** + * Gets playback + * + * @return \Flat\APIClient\Model\AssignmentSubmissionPlayback[]|null + */ + public function getPlayback(): ?array + { + return $this->container['playback']; + } + + /** + * Sets playback + * + * @param \Flat\APIClient\Model\AssignmentSubmissionPlayback[]|null $playback playback + * + * @return $this + */ + public function setPlayback(?array $playback): static + { + if (is_null($playback)) { + throw new InvalidArgumentException('non-nullable playback cannot be null'); + } + $this->container['playback'] = $playback; + + return $this; + } + + /** + * Gets submit + * + * @return bool|null + */ + public function getSubmit(): ?bool + { + return $this->container['submit']; + } + + /** + * Sets submit + * + * @param bool|null $submit If `true`, the submission will be marked as done + * + * @return $this + */ + public function setSubmit(?bool $submit): static + { + if (is_null($submit)) { + throw new InvalidArgumentException('non-nullable submit cannot be null'); + } + $this->container['submit'] = $submit; + + return $this; + } + + /** + * Gets draft_grade + * + * @return float|null + */ + public function getDraftGrade(): ?float + { + return $this->container['draft_grade']; + } + + /** + * Sets draft_grade + * + * @param float|null $draft_grade Optional grade. If unset, no grade was set. This value is only visible by the teacher, and we will be set to `grade` once the teacher returns the submission + * + * @return $this + */ + public function setDraftGrade(?float $draft_grade): static + { + if (is_null($draft_grade)) { + array_push($this->openAPINullablesSetToNull, 'draft_grade'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('draft_grade', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($draft_grade) && ($draft_grade > 10000)) { + throw new InvalidArgumentException('invalid value for $draft_grade when calling AssignmentSubmissionUpdate., must be smaller than or equal to 10000.'); + } + if (!is_null($draft_grade) && ($draft_grade < 0)) { + throw new InvalidArgumentException('invalid value for $draft_grade when calling AssignmentSubmissionUpdate., must be bigger than or equal to 0.'); + } + + $this->container['draft_grade'] = $draft_grade; + + return $this; + } + + /** + * Gets grade + * + * @return float|null + */ + public function getGrade(): ?float + { + return $this->container['grade']; + } + + /** + * Sets grade + * + * @param float|null $grade Optional grade. If unset, no grade was set. + * + * @return $this + */ + public function setGrade(?float $grade): static + { + if (is_null($grade)) { + array_push($this->openAPINullablesSetToNull, 'grade'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('grade', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($grade) && ($grade > 10000)) { + throw new InvalidArgumentException('invalid value for $grade when calling AssignmentSubmissionUpdate., must be smaller than or equal to 10000.'); + } + if (!is_null($grade) && ($grade < 0)) { + throw new InvalidArgumentException('invalid value for $grade when calling AssignmentSubmissionUpdate., must be bigger than or equal to 0.'); + } + + $this->container['grade'] = $grade; + + return $this; + } + + /** + * Gets exercises_ids + * + * @return string[]|null + */ + public function getExercisesIds(): ?array + { + return $this->container['exercises_ids']; + } + + /** + * Sets exercises_ids + * + * @param string[]|null $exercises_ids The ids of exercises when they need to be in a specific order + * + * @return $this + */ + public function setExercisesIds(?array $exercises_ids): static + { + if (is_null($exercises_ids)) { + array_push($this->openAPINullablesSetToNull, 'exercises_ids'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('exercises_ids', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['exercises_ids'] = $exercises_ids; + + return $this; + } + + /** + * Gets return + * + * @return bool|null + */ + public function getReturn(): ?bool + { + return $this->container['return']; + } + + /** + * Sets return + * + * @param bool|null $return If `true`, the submission will be marked as done + * + * @return $this + */ + public function setReturn(?bool $return): static + { + if (is_null($return)) { + throw new InvalidArgumentException('non-nullable return cannot be null'); + } + $this->container['return'] = $return; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AssignmentType.php b/src/Model/AssignmentType.php new file mode 100644 index 0000000..7073fd8 --- /dev/null +++ b/src/Model/AssignmentType.php @@ -0,0 +1,56 @@ + + */ +class AssignmentUpdate implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'AssignmentUpdate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => '\Flat\APIClient\Model\AssignmentType', + 'title' => 'string', + 'description' => 'string', + 'description_html' => 'string', + 'teacher_instructions' => 'string', + 'teacher_instructions_html' => 'string', + 'attachments' => '\Flat\APIClient\Model\ClassAttachmentCreation[]', + 'nb_playback_authorized' => 'float', + 'restrict_play_note' => 'bool', + 'restrict_to_audio_tracks' => 'bool', + 'toolset' => 'string', + 'cover_file' => 'string', + 'cover' => 'string', + 'max_points' => 'float', + 'release_grades' => 'string', + 'shuffle_exercises' => 'bool', + 'submission_students_mode' => '\Flat\APIClient\Model\AssignmentSubmissionStudentsMode', + 'recording_type' => 'string', + 'allow_metronome' => 'bool', + 'allow_backing_track' => 'bool', + 'allow_speed_change' => 'bool', + 'free_record' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'title' => null, + 'description' => null, + 'description_html' => null, + 'teacher_instructions' => null, + 'teacher_instructions_html' => null, + 'attachments' => null, + 'nb_playback_authorized' => null, + 'restrict_play_note' => null, + 'restrict_to_audio_tracks' => null, + 'toolset' => null, + 'cover_file' => null, + 'cover' => null, + 'max_points' => null, + 'release_grades' => null, + 'shuffle_exercises' => null, + 'submission_students_mode' => null, + 'recording_type' => null, + 'allow_metronome' => null, + 'allow_backing_track' => null, + 'allow_speed_change' => null, + 'free_record' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'title' => false, + 'description' => false, + 'description_html' => false, + 'teacher_instructions' => false, + 'teacher_instructions_html' => false, + 'attachments' => false, + 'nb_playback_authorized' => true, + 'restrict_play_note' => false, + 'restrict_to_audio_tracks' => false, + 'toolset' => true, + 'cover_file' => true, + 'cover' => true, + 'max_points' => true, + 'release_grades' => false, + 'shuffle_exercises' => false, + 'submission_students_mode' => false, + 'recording_type' => false, + 'allow_metronome' => false, + 'allow_backing_track' => false, + 'allow_speed_change' => false, + 'free_record' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'title' => 'title', + 'description' => 'description', + 'description_html' => 'descriptionHtml', + 'teacher_instructions' => 'teacherInstructions', + 'teacher_instructions_html' => 'teacherInstructionsHtml', + 'attachments' => 'attachments', + 'nb_playback_authorized' => 'nbPlaybackAuthorized', + 'restrict_play_note' => 'restrictPlayNote', + 'restrict_to_audio_tracks' => 'restrictToAudioTracks', + 'toolset' => 'toolset', + 'cover_file' => 'coverFile', + 'cover' => 'cover', + 'max_points' => 'maxPoints', + 'release_grades' => 'releaseGrades', + 'shuffle_exercises' => 'shuffleExercises', + 'submission_students_mode' => 'submissionStudentsMode', + 'recording_type' => 'recordingType', + 'allow_metronome' => 'allowMetronome', + 'allow_backing_track' => 'allowBackingTrack', + 'allow_speed_change' => 'allowSpeedChange', + 'free_record' => 'freeRecord' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'title' => 'setTitle', + 'description' => 'setDescription', + 'description_html' => 'setDescriptionHtml', + 'teacher_instructions' => 'setTeacherInstructions', + 'teacher_instructions_html' => 'setTeacherInstructionsHtml', + 'attachments' => 'setAttachments', + 'nb_playback_authorized' => 'setNbPlaybackAuthorized', + 'restrict_play_note' => 'setRestrictPlayNote', + 'restrict_to_audio_tracks' => 'setRestrictToAudioTracks', + 'toolset' => 'setToolset', + 'cover_file' => 'setCoverFile', + 'cover' => 'setCover', + 'max_points' => 'setMaxPoints', + 'release_grades' => 'setReleaseGrades', + 'shuffle_exercises' => 'setShuffleExercises', + 'submission_students_mode' => 'setSubmissionStudentsMode', + 'recording_type' => 'setRecordingType', + 'allow_metronome' => 'setAllowMetronome', + 'allow_backing_track' => 'setAllowBackingTrack', + 'allow_speed_change' => 'setAllowSpeedChange', + 'free_record' => 'setFreeRecord' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'title' => 'getTitle', + 'description' => 'getDescription', + 'description_html' => 'getDescriptionHtml', + 'teacher_instructions' => 'getTeacherInstructions', + 'teacher_instructions_html' => 'getTeacherInstructionsHtml', + 'attachments' => 'getAttachments', + 'nb_playback_authorized' => 'getNbPlaybackAuthorized', + 'restrict_play_note' => 'getRestrictPlayNote', + 'restrict_to_audio_tracks' => 'getRestrictToAudioTracks', + 'toolset' => 'getToolset', + 'cover_file' => 'getCoverFile', + 'cover' => 'getCover', + 'max_points' => 'getMaxPoints', + 'release_grades' => 'getReleaseGrades', + 'shuffle_exercises' => 'getShuffleExercises', + 'submission_students_mode' => 'getSubmissionStudentsMode', + 'recording_type' => 'getRecordingType', + 'allow_metronome' => 'getAllowMetronome', + 'allow_backing_track' => 'getAllowBackingTrack', + 'allow_speed_change' => 'getAllowSpeedChange', + 'free_record' => 'getFreeRecord' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const RELEASE_GRADES_AUTO = 'auto'; + public const RELEASE_GRADES_MANUAL = 'manual'; + public const RECORDING_TYPE_AUDIO = 'audio'; + public const RECORDING_TYPE_VIDEO = 'video'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getReleaseGradesAllowableValues() + { + return [ + self::RELEASE_GRADES_AUTO, + self::RELEASE_GRADES_MANUAL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getRecordingTypeAllowableValues() + { + return [ + self::RECORDING_TYPE_AUDIO, + self::RECORDING_TYPE_VIDEO, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('description_html', $data ?? [], null); + $this->setIfExists('teacher_instructions', $data ?? [], null); + $this->setIfExists('teacher_instructions_html', $data ?? [], null); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('nb_playback_authorized', $data ?? [], null); + $this->setIfExists('restrict_play_note', $data ?? [], null); + $this->setIfExists('restrict_to_audio_tracks', $data ?? [], null); + $this->setIfExists('toolset', $data ?? [], null); + $this->setIfExists('cover_file', $data ?? [], null); + $this->setIfExists('cover', $data ?? [], null); + $this->setIfExists('max_points', $data ?? [], null); + $this->setIfExists('release_grades', $data ?? [], null); + $this->setIfExists('shuffle_exercises', $data ?? [], null); + $this->setIfExists('submission_students_mode', $data ?? [], null); + $this->setIfExists('recording_type', $data ?? [], null); + $this->setIfExists('allow_metronome', $data ?? [], null); + $this->setIfExists('allow_backing_track', $data ?? [], null); + $this->setIfExists('allow_speed_change', $data ?? [], null); + $this->setIfExists('free_record', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['title']) && (mb_strlen($this->container['title']) > 1000)) { + $invalidProperties[] = "invalid value for 'title', the character length must be smaller than or equal to 1000."; + } + + if (!is_null($this->container['title']) && (mb_strlen($this->container['title']) < 1)) { + $invalidProperties[] = "invalid value for 'title', the character length must be bigger than or equal to 1."; + } + + if (!is_null($this->container['description']) && (mb_strlen($this->container['description']) > 100000)) { + $invalidProperties[] = "invalid value for 'description', the character length must be smaller than or equal to 100000."; + } + + if (!is_null($this->container['description_html']) && (mb_strlen($this->container['description_html']) > 20000000)) { + $invalidProperties[] = "invalid value for 'description_html', the character length must be smaller than or equal to 20000000."; + } + + if (!is_null($this->container['teacher_instructions']) && (mb_strlen($this->container['teacher_instructions']) > 100000)) { + $invalidProperties[] = "invalid value for 'teacher_instructions', the character length must be smaller than or equal to 100000."; + } + + if (!is_null($this->container['teacher_instructions_html']) && (mb_strlen($this->container['teacher_instructions_html']) > 20000000)) { + $invalidProperties[] = "invalid value for 'teacher_instructions_html', the character length must be smaller than or equal to 20000000."; + } + + if (!is_null($this->container['max_points']) && ($this->container['max_points'] > 10000)) { + $invalidProperties[] = "invalid value for 'max_points', must be smaller than or equal to 10000."; + } + + if (!is_null($this->container['max_points']) && ($this->container['max_points'] < 0)) { + $invalidProperties[] = "invalid value for 'max_points', must be bigger than or equal to 0."; + } + + $allowedValues = self::getReleaseGradesAllowableValues(); + if (!is_null($this->container['release_grades']) && !in_array($this->container['release_grades'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'release_grades', must be one of '%s'", + $this->container['release_grades'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = self::getRecordingTypeAllowableValues(); + if (!is_null($this->container['recording_type']) && !in_array($this->container['recording_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'recording_type', must be one of '%s'", + $this->container['recording_type'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return \Flat\APIClient\Model\AssignmentType|null + */ + public function getType(): ?\Flat\APIClient\Model\AssignmentType + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Flat\APIClient\Model\AssignmentType|null $type type + * + * @return $this + */ + public function setType(?\Flat\APIClient\Model\AssignmentType $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle(): ?string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title Title of the assignment + * + * @return $this + */ + public function setTitle(?string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + if ((mb_strlen($title) > 1000)) { + throw new InvalidArgumentException('invalid length for $title when calling AssignmentUpdate., must be smaller than or equal to 1000.'); + } + if ((mb_strlen($title) < 1)) { + throw new InvalidArgumentException('invalid length for $title when calling AssignmentUpdate., must be bigger than or equal to 1.'); + } + + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Student instructions and content of the assignment (plain text) + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + if ((mb_strlen($description) > 100000)) { + throw new InvalidArgumentException('invalid length for $description when calling AssignmentUpdate., must be smaller than or equal to 100000.'); + } + + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets description_html + * + * @return string|null + */ + public function getDescriptionHtml(): ?string + { + return $this->container['description_html']; + } + + /** + * Sets description_html + * + * @param string|null $description_html HTML version of student instructions. Pasted images may be sent as inline base64 `data:` URIs; they are uploaded to storage and rewritten to hosted URLs on save. The final HTML is limited to 100000 characters. When provided, the plain text version will be automatically extracted for compatibility. + * + * @return $this + */ + public function setDescriptionHtml(?string $description_html): static + { + if (is_null($description_html)) { + throw new InvalidArgumentException('non-nullable description_html cannot be null'); + } + if ((mb_strlen($description_html) > 20000000)) { + throw new InvalidArgumentException('invalid length for $description_html when calling AssignmentUpdate., must be smaller than or equal to 20000000.'); + } + + $this->container['description_html'] = $description_html; + + return $this; + } + + /** + * Gets teacher_instructions + * + * @return string|null + */ + public function getTeacherInstructions(): ?string + { + return $this->container['teacher_instructions']; + } + + /** + * Sets teacher_instructions + * + * @param string|null $teacher_instructions Teacher-only instructions (plain text) + * + * @return $this + */ + public function setTeacherInstructions(?string $teacher_instructions): static + { + if (is_null($teacher_instructions)) { + throw new InvalidArgumentException('non-nullable teacher_instructions cannot be null'); + } + if ((mb_strlen($teacher_instructions) > 100000)) { + throw new InvalidArgumentException('invalid length for $teacher_instructions when calling AssignmentUpdate., must be smaller than or equal to 100000.'); + } + + $this->container['teacher_instructions'] = $teacher_instructions; + + return $this; + } + + /** + * Gets teacher_instructions_html + * + * @return string|null + */ + public function getTeacherInstructionsHtml(): ?string + { + return $this->container['teacher_instructions_html']; + } + + /** + * Sets teacher_instructions_html + * + * @param string|null $teacher_instructions_html HTML version of teacher-only instructions. Pasted images may be sent as inline base64 `data:` URIs; they are uploaded to storage and rewritten to hosted URLs on save. The final HTML is limited to 100000 characters. When provided, the plain text version will be automatically extracted for compatibility. + * + * @return $this + */ + public function setTeacherInstructionsHtml(?string $teacher_instructions_html): static + { + if (is_null($teacher_instructions_html)) { + throw new InvalidArgumentException('non-nullable teacher_instructions_html cannot be null'); + } + if ((mb_strlen($teacher_instructions_html) > 20000000)) { + throw new InvalidArgumentException('invalid length for $teacher_instructions_html when calling AssignmentUpdate., must be smaller than or equal to 20000000.'); + } + + $this->container['teacher_instructions_html'] = $teacher_instructions_html; + + return $this; + } + + /** + * Gets attachments + * + * @return \Flat\APIClient\Model\ClassAttachmentCreation[]|null + */ + public function getAttachments(): ?array + { + return $this->container['attachments']; + } + + /** + * Sets attachments + * + * @param \Flat\APIClient\Model\ClassAttachmentCreation[]|null $attachments The complete attachment list. Omitting this property on an update leaves the existing attachments alone; sending it replaces them. Dropping a dedicated score from the list deletes the students' copies of it, so send the full set you want to keep rather than only the additions. Duplicates, judged by `url`, `score`, `worksheet` or `googleDriveFileId`, are discarded silently, and exceeding the per-assignment limit fails with `ASSIGNMENT_ATTACHMENTS_LIMIT`. + * + * @return $this + */ + public function setAttachments(?array $attachments): static + { + if (is_null($attachments)) { + throw new InvalidArgumentException('non-nullable attachments cannot be null'); + } + $this->container['attachments'] = $attachments; + + return $this; + } + + /** + * Gets nb_playback_authorized + * + * @return float|null + */ + public function getNbPlaybackAuthorized(): ?float + { + return $this->container['nb_playback_authorized']; + } + + /** + * Sets nb_playback_authorized + * + * @param float|null $nb_playback_authorized The number of playback authorized on the scores of the assignment. + * + * @return $this + */ + public function setNbPlaybackAuthorized(?float $nb_playback_authorized): static + { + if (is_null($nb_playback_authorized)) { + array_push($this->openAPINullablesSetToNull, 'nb_playback_authorized'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nb_playback_authorized', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nb_playback_authorized'] = $nb_playback_authorized; + + return $this; + } + + /** + * Gets restrict_play_note + * + * @return bool|null + */ + public function getRestrictPlayNote(): ?bool + { + return $this->container['restrict_play_note']; + } + + /** + * Sets restrict_play_note + * + * @param bool|null $restrict_play_note Restrict the ability to get an audio feedback every time a student adds or selects a note. + * + * @return $this + */ + public function setRestrictPlayNote(?bool $restrict_play_note): static + { + if (is_null($restrict_play_note)) { + throw new InvalidArgumentException('non-nullable restrict_play_note cannot be null'); + } + $this->container['restrict_play_note'] = $restrict_play_note; + + return $this; + } + + /** + * Gets restrict_to_audio_tracks + * + * @return bool|null + */ + public function getRestrictToAudioTracks(): ?bool + { + return $this->container['restrict_to_audio_tracks']; + } + + /** + * Sets restrict_to_audio_tracks + * + * @param bool|null $restrict_to_audio_tracks Restrict the audio source to provided audio tracks on a score. Students won't be able to use the editor playback. + * + * @return $this + */ + public function setRestrictToAudioTracks(?bool $restrict_to_audio_tracks): static + { + if (is_null($restrict_to_audio_tracks)) { + throw new InvalidArgumentException('non-nullable restrict_to_audio_tracks cannot be null'); + } + $this->container['restrict_to_audio_tracks'] = $restrict_to_audio_tracks; + + return $this; + } + + /** + * Gets toolset + * + * @return string|null + */ + public function getToolset(): ?string + { + return $this->container['toolset']; + } + + /** + * Sets toolset + * + * @param string|null $toolset The id of the toolset to apply to this assignment. The toolset will be copied to the assignment as a dedicated object to prevent unexpected changes when making modifications to the template toolset. This property can be set to null to delete the linked toolset and switch back to all the tools available for this assignment. + * + * @return $this + */ + public function setToolset(?string $toolset): static + { + if (is_null($toolset)) { + array_push($this->openAPINullablesSetToNull, 'toolset'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('toolset', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['toolset'] = $toolset; + + return $this; + } + + /** + * Gets cover_file + * + * @return string|null + */ + public function getCoverFile(): ?string + { + return $this->container['cover_file']; + } + + /** + * Sets cover_file + * + * @param string|null $cover_file The id of the cover to display + * + * @return $this + */ + public function setCoverFile(?string $cover_file): static + { + if (is_null($cover_file)) { + array_push($this->openAPINullablesSetToNull, 'cover_file'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cover_file', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['cover_file'] = $cover_file; + + return $this; + } + + /** + * Gets cover + * + * @return string|null + */ + public function getCover(): ?string + { + return $this->container['cover']; + } + + /** + * Sets cover + * + * @param string|null $cover The URL of the cover to display + * + * @return $this + */ + public function setCover(?string $cover): static + { + if (is_null($cover)) { + array_push($this->openAPINullablesSetToNull, 'cover'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cover', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['cover'] = $cover; + + return $this; + } + + /** + * Gets max_points + * + * @return float|null + */ + public function getMaxPoints(): ?float + { + return $this->container['max_points']; + } + + /** + * Sets max_points + * + * @param float|null $max_points If set, the grading will be enabled for the assignement with this value as the maximum of points + * + * @return $this + */ + public function setMaxPoints(?float $max_points): static + { + if (is_null($max_points)) { + array_push($this->openAPINullablesSetToNull, 'max_points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('max_points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($max_points) && ($max_points > 10000)) { + throw new InvalidArgumentException('invalid value for $max_points when calling AssignmentUpdate., must be smaller than or equal to 10000.'); + } + if (!is_null($max_points) && ($max_points < 0)) { + throw new InvalidArgumentException('invalid value for $max_points when calling AssignmentUpdate., must be bigger than or equal to 0.'); + } + + $this->container['max_points'] = $max_points; + + return $this; + } + + /** + * Gets release_grades + * + * @return string|null + */ + public function getReleaseGrades(): ?string + { + return $this->container['release_grades']; + } + + /** + * Sets release_grades + * + * @param string|null $release_grades For worksheets, how grading will work for the assignment: - If set to `auto`, the grades will be automatically released when the student submits the submissions - If set to `manual`, the grades will only be set as `draftGrade` and will be released when the teacher returns the submissions + * + * @return $this + */ + public function setReleaseGrades(?string $release_grades): static + { + if (is_null($release_grades)) { + throw new InvalidArgumentException('non-nullable release_grades cannot be null'); + } + $allowedValues = self::getReleaseGradesAllowableValues(); + if (!in_array($release_grades, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'release_grades', must be one of '%s'", + $release_grades, + implode("', '", $allowedValues) + ) + ); + } + $this->container['release_grades'] = $release_grades; + + return $this; + } + + /** + * Gets shuffle_exercises + * + * @return bool|null + */ + public function getShuffleExercises(): ?bool + { + return $this->container['shuffle_exercises']; + } + + /** + * Sets shuffle_exercises + * + * @param bool|null $shuffle_exercises Mixing worksheets exercises for each student + * + * @return $this + */ + public function setShuffleExercises(?bool $shuffle_exercises): static + { + if (is_null($shuffle_exercises)) { + throw new InvalidArgumentException('non-nullable shuffle_exercises cannot be null'); + } + $this->container['shuffle_exercises'] = $shuffle_exercises; + + return $this; + } + + /** + * Gets submission_students_mode + * + * @return \Flat\APIClient\Model\AssignmentSubmissionStudentsMode|null + */ + public function getSubmissionStudentsMode(): ?\Flat\APIClient\Model\AssignmentSubmissionStudentsMode + { + return $this->container['submission_students_mode']; + } + + /** + * Sets submission_students_mode + * + * @param \Flat\APIClient\Model\AssignmentSubmissionStudentsMode|null $submission_students_mode submission_students_mode + * + * @return $this + */ + public function setSubmissionStudentsMode(?\Flat\APIClient\Model\AssignmentSubmissionStudentsMode $submission_students_mode): static + { + if (is_null($submission_students_mode)) { + throw new InvalidArgumentException('non-nullable submission_students_mode cannot be null'); + } + $this->container['submission_students_mode'] = $submission_students_mode; + + return $this; + } + + /** + * Gets recording_type + * + * @return string|null + */ + public function getRecordingType(): ?string + { + return $this->container['recording_type']; + } + + /** + * Sets recording_type + * + * @param string|null $recording_type For performance assignments: recording type that will be either 'audio' or 'video'. * `audio`: Only audio will be required during the recording. * `video`: Camera will be required during the recording. Only set when type is 'performance'. + * + * @return $this + */ + public function setRecordingType(?string $recording_type): static + { + if (is_null($recording_type)) { + throw new InvalidArgumentException('non-nullable recording_type cannot be null'); + } + $allowedValues = self::getRecordingTypeAllowableValues(); + if (!in_array($recording_type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'recording_type', must be one of '%s'", + $recording_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['recording_type'] = $recording_type; + + return $this; + } + + /** + * Gets allow_metronome + * + * @return bool|null + */ + public function getAllowMetronome(): ?bool + { + return $this->container['allow_metronome']; + } + + /** + * Sets allow_metronome + * + * @param bool|null $allow_metronome For performance assignments: Enable students to use the metronome while they are recording, helping them stay in time. Only set when type is 'performance'. + * + * @return $this + */ + public function setAllowMetronome(?bool $allow_metronome): static + { + if (is_null($allow_metronome)) { + throw new InvalidArgumentException('non-nullable allow_metronome cannot be null'); + } + $this->container['allow_metronome'] = $allow_metronome; + + return $this; + } + + /** + * Gets allow_backing_track + * + * @return bool|null + */ + public function getAllowBackingTrack(): ?bool + { + return $this->container['allow_backing_track']; + } + + /** + * Sets allow_backing_track + * + * @param bool|null $allow_backing_track For performance assignments: Enable students to listen to the accompaniment without their instrument part while they are playing. Only set when type is 'performance'. + * + * @return $this + */ + public function setAllowBackingTrack(?bool $allow_backing_track): static + { + if (is_null($allow_backing_track)) { + throw new InvalidArgumentException('non-nullable allow_backing_track cannot be null'); + } + $this->container['allow_backing_track'] = $allow_backing_track; + + return $this; + } + + /** + * Gets allow_speed_change + * + * @return bool|null + */ + public function getAllowSpeedChange(): ?bool + { + return $this->container['allow_speed_change']; + } + + /** + * Sets allow_speed_change + * + * @param bool|null $allow_speed_change For performance assignments: whether students can adjust the playback speed of the score during recording. * `true`: Students can change the tempo/speed during practice and recording * `false`: Tempo is fixed to the original score tempo Only set when type is 'performance'. + * + * @return $this + */ + public function setAllowSpeedChange(?bool $allow_speed_change): static + { + if (is_null($allow_speed_change)) { + throw new InvalidArgumentException('non-nullable allow_speed_change cannot be null'); + } + $this->container['allow_speed_change'] = $allow_speed_change; + + return $this; + } + + /** + * Gets free_record + * + * @return bool|null + */ + public function getFreeRecord(): ?bool + { + return $this->container['free_record']; + } + + /** + * Sets free_record + * + * @param bool|null $free_record For performance assignments: \"Free Record\" mode. When `true`, no score is attached to the assignment. Students freely record a varied repertoire or an ensemble performance without being constrained by a single score's structure or duration, and all score-dependent options (playback, metronome, backtracking, speed control) are hidden. Only set when type is 'performance'. + * + * @return $this + */ + public function setFreeRecord(?bool $free_record): static + { + if (is_null($free_record)) { + throw new InvalidArgumentException('non-nullable free_record cannot be null'); + } + $this->container['free_record'] = $free_record; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ClassAssignment.php b/src/Model/ClassAssignment.php new file mode 100644 index 0000000..512d4e6 --- /dev/null +++ b/src/Model/ClassAssignment.php @@ -0,0 +1,1906 @@ + + */ +class ClassAssignment implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ClassAssignment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'type' => '\Flat\APIClient\Model\AssignmentType', + 'capabilities' => '\Flat\APIClient\Model\AssignmentCapabilities', + 'title' => 'string', + 'description' => 'string', + 'description_html' => 'string', + 'teacher_instructions' => 'string', + 'teacher_instructions_html' => 'string', + 'cover' => 'string', + 'cover_file' => 'string', + 'attachments' => '\Flat\APIClient\Model\MediaAttachment[]', + 'use_dedicated_attachments' => 'bool', + 'max_points' => 'float', + 'release_grades' => 'string', + 'shuffle_exercises' => 'bool', + 'toolset' => 'string', + 'nb_playback_authorized' => 'float', + 'restrict_play_note' => 'bool', + 'restrict_to_audio_tracks' => 'bool', + 'submission_students_mode' => '\Flat\APIClient\Model\AssignmentSubmissionStudentsMode', + 'recording_type' => 'string', + 'allow_metronome' => 'bool', + 'allow_backing_track' => 'bool', + 'allow_speed_change' => 'bool', + 'free_record' => 'bool', + 'creator' => 'string', + 'state' => 'string', + 'classroom' => 'string', + 'creation_date' => '\DateTime', + 'scheduled_date' => '\DateTime', + 'due_date' => '\DateTime', + 'assignee_mode' => 'string', + 'assigned_students' => 'string[]', + 'assigned_groups' => '\Flat\APIClient\Model\AssignmentGroup[]', + 'submissions' => '\Flat\APIClient\Model\AssignmentSubmission[]', + 'google_classroom' => '\Flat\APIClient\Model\GoogleClassroomCoursework', + 'microsoft_graph' => '\Flat\APIClient\Model\MicrosoftGraphAssignment', + 'mfc' => '\Flat\APIClient\Model\ClassAssignmentAllOfMfc', + 'canvas' => '\Flat\APIClient\Model\ClassAssignmentAllOfCanvas', + 'lti' => '\Flat\APIClient\Model\ClassAssignmentAllOfLti', + 'issue' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'type' => null, + 'capabilities' => null, + 'title' => null, + 'description' => null, + 'description_html' => null, + 'teacher_instructions' => null, + 'teacher_instructions_html' => null, + 'cover' => null, + 'cover_file' => null, + 'attachments' => null, + 'use_dedicated_attachments' => null, + 'max_points' => null, + 'release_grades' => null, + 'shuffle_exercises' => null, + 'toolset' => null, + 'nb_playback_authorized' => null, + 'restrict_play_note' => null, + 'restrict_to_audio_tracks' => null, + 'submission_students_mode' => null, + 'recording_type' => null, + 'allow_metronome' => null, + 'allow_backing_track' => null, + 'allow_speed_change' => null, + 'free_record' => null, + 'creator' => null, + 'state' => null, + 'classroom' => null, + 'creation_date' => 'date-time', + 'scheduled_date' => 'date-time', + 'due_date' => 'date-time', + 'assignee_mode' => null, + 'assigned_students' => null, + 'assigned_groups' => null, + 'submissions' => null, + 'google_classroom' => null, + 'microsoft_graph' => null, + 'mfc' => null, + 'canvas' => null, + 'lti' => null, + 'issue' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'type' => false, + 'capabilities' => false, + 'title' => false, + 'description' => false, + 'description_html' => false, + 'teacher_instructions' => false, + 'teacher_instructions_html' => false, + 'cover' => false, + 'cover_file' => false, + 'attachments' => false, + 'use_dedicated_attachments' => false, + 'max_points' => false, + 'release_grades' => false, + 'shuffle_exercises' => false, + 'toolset' => false, + 'nb_playback_authorized' => false, + 'restrict_play_note' => false, + 'restrict_to_audio_tracks' => false, + 'submission_students_mode' => false, + 'recording_type' => false, + 'allow_metronome' => false, + 'allow_backing_track' => false, + 'allow_speed_change' => false, + 'free_record' => false, + 'creator' => false, + 'state' => false, + 'classroom' => false, + 'creation_date' => false, + 'scheduled_date' => false, + 'due_date' => false, + 'assignee_mode' => false, + 'assigned_students' => false, + 'assigned_groups' => false, + 'submissions' => false, + 'google_classroom' => false, + 'microsoft_graph' => false, + 'mfc' => false, + 'canvas' => false, + 'lti' => false, + 'issue' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'type' => 'type', + 'capabilities' => 'capabilities', + 'title' => 'title', + 'description' => 'description', + 'description_html' => 'descriptionHtml', + 'teacher_instructions' => 'teacherInstructions', + 'teacher_instructions_html' => 'teacherInstructionsHtml', + 'cover' => 'cover', + 'cover_file' => 'coverFile', + 'attachments' => 'attachments', + 'use_dedicated_attachments' => 'useDedicatedAttachments', + 'max_points' => 'maxPoints', + 'release_grades' => 'releaseGrades', + 'shuffle_exercises' => 'shuffleExercises', + 'toolset' => 'toolset', + 'nb_playback_authorized' => 'nbPlaybackAuthorized', + 'restrict_play_note' => 'restrictPlayNote', + 'restrict_to_audio_tracks' => 'restrictToAudioTracks', + 'submission_students_mode' => 'submissionStudentsMode', + 'recording_type' => 'recordingType', + 'allow_metronome' => 'allowMetronome', + 'allow_backing_track' => 'allowBackingTrack', + 'allow_speed_change' => 'allowSpeedChange', + 'free_record' => 'freeRecord', + 'creator' => 'creator', + 'state' => 'state', + 'classroom' => 'classroom', + 'creation_date' => 'creationDate', + 'scheduled_date' => 'scheduledDate', + 'due_date' => 'dueDate', + 'assignee_mode' => 'assigneeMode', + 'assigned_students' => 'assignedStudents', + 'assigned_groups' => 'assignedGroups', + 'submissions' => 'submissions', + 'google_classroom' => 'googleClassroom', + 'microsoft_graph' => 'microsoftGraph', + 'mfc' => 'mfc', + 'canvas' => 'canvas', + 'lti' => 'lti', + 'issue' => 'issue' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'type' => 'setType', + 'capabilities' => 'setCapabilities', + 'title' => 'setTitle', + 'description' => 'setDescription', + 'description_html' => 'setDescriptionHtml', + 'teacher_instructions' => 'setTeacherInstructions', + 'teacher_instructions_html' => 'setTeacherInstructionsHtml', + 'cover' => 'setCover', + 'cover_file' => 'setCoverFile', + 'attachments' => 'setAttachments', + 'use_dedicated_attachments' => 'setUseDedicatedAttachments', + 'max_points' => 'setMaxPoints', + 'release_grades' => 'setReleaseGrades', + 'shuffle_exercises' => 'setShuffleExercises', + 'toolset' => 'setToolset', + 'nb_playback_authorized' => 'setNbPlaybackAuthorized', + 'restrict_play_note' => 'setRestrictPlayNote', + 'restrict_to_audio_tracks' => 'setRestrictToAudioTracks', + 'submission_students_mode' => 'setSubmissionStudentsMode', + 'recording_type' => 'setRecordingType', + 'allow_metronome' => 'setAllowMetronome', + 'allow_backing_track' => 'setAllowBackingTrack', + 'allow_speed_change' => 'setAllowSpeedChange', + 'free_record' => 'setFreeRecord', + 'creator' => 'setCreator', + 'state' => 'setState', + 'classroom' => 'setClassroom', + 'creation_date' => 'setCreationDate', + 'scheduled_date' => 'setScheduledDate', + 'due_date' => 'setDueDate', + 'assignee_mode' => 'setAssigneeMode', + 'assigned_students' => 'setAssignedStudents', + 'assigned_groups' => 'setAssignedGroups', + 'submissions' => 'setSubmissions', + 'google_classroom' => 'setGoogleClassroom', + 'microsoft_graph' => 'setMicrosoftGraph', + 'mfc' => 'setMfc', + 'canvas' => 'setCanvas', + 'lti' => 'setLti', + 'issue' => 'setIssue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'type' => 'getType', + 'capabilities' => 'getCapabilities', + 'title' => 'getTitle', + 'description' => 'getDescription', + 'description_html' => 'getDescriptionHtml', + 'teacher_instructions' => 'getTeacherInstructions', + 'teacher_instructions_html' => 'getTeacherInstructionsHtml', + 'cover' => 'getCover', + 'cover_file' => 'getCoverFile', + 'attachments' => 'getAttachments', + 'use_dedicated_attachments' => 'getUseDedicatedAttachments', + 'max_points' => 'getMaxPoints', + 'release_grades' => 'getReleaseGrades', + 'shuffle_exercises' => 'getShuffleExercises', + 'toolset' => 'getToolset', + 'nb_playback_authorized' => 'getNbPlaybackAuthorized', + 'restrict_play_note' => 'getRestrictPlayNote', + 'restrict_to_audio_tracks' => 'getRestrictToAudioTracks', + 'submission_students_mode' => 'getSubmissionStudentsMode', + 'recording_type' => 'getRecordingType', + 'allow_metronome' => 'getAllowMetronome', + 'allow_backing_track' => 'getAllowBackingTrack', + 'allow_speed_change' => 'getAllowSpeedChange', + 'free_record' => 'getFreeRecord', + 'creator' => 'getCreator', + 'state' => 'getState', + 'classroom' => 'getClassroom', + 'creation_date' => 'getCreationDate', + 'scheduled_date' => 'getScheduledDate', + 'due_date' => 'getDueDate', + 'assignee_mode' => 'getAssigneeMode', + 'assigned_students' => 'getAssignedStudents', + 'assigned_groups' => 'getAssignedGroups', + 'submissions' => 'getSubmissions', + 'google_classroom' => 'getGoogleClassroom', + 'microsoft_graph' => 'getMicrosoftGraph', + 'mfc' => 'getMfc', + 'canvas' => 'getCanvas', + 'lti' => 'getLti', + 'issue' => 'getIssue' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const RELEASE_GRADES_AUTO = 'auto'; + public const RELEASE_GRADES_MANUAL = 'manual'; + public const RECORDING_TYPE_AUDIO = 'audio'; + public const RECORDING_TYPE_VIDEO = 'video'; + public const STATE_DRAFT = 'draft'; + public const STATE_ACTIVE = 'active'; + public const STATE_ARCHIVED = 'archived'; + public const ASSIGNEE_MODE_EVERYONE = 'everyone'; + public const ASSIGNEE_MODE_SELECTED = 'selected'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getReleaseGradesAllowableValues() + { + return [ + self::RELEASE_GRADES_AUTO, + self::RELEASE_GRADES_MANUAL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getRecordingTypeAllowableValues() + { + return [ + self::RECORDING_TYPE_AUDIO, + self::RECORDING_TYPE_VIDEO, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getStateAllowableValues() + { + return [ + self::STATE_DRAFT, + self::STATE_ACTIVE, + self::STATE_ARCHIVED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getAssigneeModeAllowableValues() + { + return [ + self::ASSIGNEE_MODE_EVERYONE, + self::ASSIGNEE_MODE_SELECTED, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('capabilities', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('description_html', $data ?? [], null); + $this->setIfExists('teacher_instructions', $data ?? [], null); + $this->setIfExists('teacher_instructions_html', $data ?? [], null); + $this->setIfExists('cover', $data ?? [], null); + $this->setIfExists('cover_file', $data ?? [], null); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('use_dedicated_attachments', $data ?? [], null); + $this->setIfExists('max_points', $data ?? [], null); + $this->setIfExists('release_grades', $data ?? [], null); + $this->setIfExists('shuffle_exercises', $data ?? [], null); + $this->setIfExists('toolset', $data ?? [], null); + $this->setIfExists('nb_playback_authorized', $data ?? [], null); + $this->setIfExists('restrict_play_note', $data ?? [], null); + $this->setIfExists('restrict_to_audio_tracks', $data ?? [], null); + $this->setIfExists('submission_students_mode', $data ?? [], null); + $this->setIfExists('recording_type', $data ?? [], null); + $this->setIfExists('allow_metronome', $data ?? [], null); + $this->setIfExists('allow_backing_track', $data ?? [], null); + $this->setIfExists('allow_speed_change', $data ?? [], null); + $this->setIfExists('free_record', $data ?? [], null); + $this->setIfExists('creator', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('classroom', $data ?? [], null); + $this->setIfExists('creation_date', $data ?? [], null); + $this->setIfExists('scheduled_date', $data ?? [], null); + $this->setIfExists('due_date', $data ?? [], null); + $this->setIfExists('assignee_mode', $data ?? [], null); + $this->setIfExists('assigned_students', $data ?? [], null); + $this->setIfExists('assigned_groups', $data ?? [], null); + $this->setIfExists('submissions', $data ?? [], null); + $this->setIfExists('google_classroom', $data ?? [], null); + $this->setIfExists('microsoft_graph', $data ?? [], null); + $this->setIfExists('mfc', $data ?? [], null); + $this->setIfExists('canvas', $data ?? [], null); + $this->setIfExists('lti', $data ?? [], null); + $this->setIfExists('issue', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['capabilities'] === null) { + $invalidProperties[] = "'capabilities' can't be null"; + } + if ($this->container['title'] === null) { + $invalidProperties[] = "'title' can't be null"; + } + if ($this->container['attachments'] === null) { + $invalidProperties[] = "'attachments' can't be null"; + } + $allowedValues = self::getReleaseGradesAllowableValues(); + if (!is_null($this->container['release_grades']) && !in_array($this->container['release_grades'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'release_grades', must be one of '%s'", + $this->container['release_grades'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = self::getRecordingTypeAllowableValues(); + if (!is_null($this->container['recording_type']) && !in_array($this->container['recording_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'recording_type', must be one of '%s'", + $this->container['recording_type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['state'] === null) { + $invalidProperties[] = "'state' can't be null"; + } + $allowedValues = self::getStateAllowableValues(); + if (!is_null($this->container['state']) && !in_array($this->container['state'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'state', must be one of '%s'", + $this->container['state'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['creation_date'] === null) { + $invalidProperties[] = "'creation_date' can't be null"; + } + $allowedValues = self::getAssigneeModeAllowableValues(); + if (!is_null($this->container['assignee_mode']) && !in_array($this->container['assignee_mode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'assignee_mode', must be one of '%s'", + $this->container['assignee_mode'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['submissions'] === null) { + $invalidProperties[] = "'submissions' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Unique identifier of the assignment + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return \Flat\APIClient\Model\AssignmentType + */ + public function getType(): \Flat\APIClient\Model\AssignmentType + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Flat\APIClient\Model\AssignmentType $type type + * + * @return $this + */ + public function setType(\Flat\APIClient\Model\AssignmentType $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets capabilities + * + * @return \Flat\APIClient\Model\AssignmentCapabilities + */ + public function getCapabilities(): \Flat\APIClient\Model\AssignmentCapabilities + { + return $this->container['capabilities']; + } + + /** + * Sets capabilities + * + * @param \Flat\APIClient\Model\AssignmentCapabilities $capabilities capabilities + * + * @return $this + */ + public function setCapabilities(\Flat\APIClient\Model\AssignmentCapabilities $capabilities): static + { + if (is_null($capabilities)) { + throw new InvalidArgumentException('non-nullable capabilities cannot be null'); + } + $this->container['capabilities'] = $capabilities; + + return $this; + } + + /** + * Gets title + * + * @return string + */ + public function getTitle(): string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string $title Title of the assignment + * + * @return $this + */ + public function setTitle(string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Student instructions and content of the assignment (plain text) + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets description_html + * + * @return string|null + */ + public function getDescriptionHtml(): ?string + { + return $this->container['description_html']; + } + + /** + * Sets description_html + * + * @param string|null $description_html HTML version of student instructions with rich text formatting. Supports the following HTML tags: p, br, strong, b, em, i, u, a, ul, ol, li, h1, h2, h3, img. Images are served as absolute http(s) URLs. + * + * @return $this + */ + public function setDescriptionHtml(?string $description_html): static + { + if (is_null($description_html)) { + throw new InvalidArgumentException('non-nullable description_html cannot be null'); + } + $this->container['description_html'] = $description_html; + + return $this; + } + + /** + * Gets teacher_instructions + * + * @return string|null + */ + public function getTeacherInstructions(): ?string + { + return $this->container['teacher_instructions']; + } + + /** + * Sets teacher_instructions + * + * @param string|null $teacher_instructions Teacher-only instructions for this assignment. These instructions are only visible to teachers and are not returned when students view the assignment. If `teacherInstructionsHtml` is provided, this field will contain the plain text version for compatibility. + * + * @return $this + */ + public function setTeacherInstructions(?string $teacher_instructions): static + { + if (is_null($teacher_instructions)) { + throw new InvalidArgumentException('non-nullable teacher_instructions cannot be null'); + } + $this->container['teacher_instructions'] = $teacher_instructions; + + return $this; + } + + /** + * Gets teacher_instructions_html + * + * @return string|null + */ + public function getTeacherInstructionsHtml(): ?string + { + return $this->container['teacher_instructions_html']; + } + + /** + * Sets teacher_instructions_html + * + * @param string|null $teacher_instructions_html HTML version of teacher-only instructions with rich text formatting. Supports the following HTML tags: p, br, strong, b, em, i, u, a, ul, ol, li, h1, h2, h3, img. Images are served as absolute http(s) URLs. + * + * @return $this + */ + public function setTeacherInstructionsHtml(?string $teacher_instructions_html): static + { + if (is_null($teacher_instructions_html)) { + throw new InvalidArgumentException('non-nullable teacher_instructions_html cannot be null'); + } + $this->container['teacher_instructions_html'] = $teacher_instructions_html; + + return $this; + } + + /** + * Gets cover + * + * @return string|null + */ + public function getCover(): ?string + { + return $this->container['cover']; + } + + /** + * Sets cover + * + * @param string|null $cover The URL of the cover to display + * + * @return $this + */ + public function setCover(?string $cover): static + { + if (is_null($cover)) { + throw new InvalidArgumentException('non-nullable cover cannot be null'); + } + $this->container['cover'] = $cover; + + return $this; + } + + /** + * Gets cover_file + * + * @return string|null + */ + public function getCoverFile(): ?string + { + return $this->container['cover_file']; + } + + /** + * Sets cover_file + * + * @param string|null $cover_file The id of the cover to display + * + * @return $this + */ + public function setCoverFile(?string $cover_file): static + { + if (is_null($cover_file)) { + throw new InvalidArgumentException('non-nullable cover_file cannot be null'); + } + $this->container['cover_file'] = $cover_file; + + return $this; + } + + /** + * Gets attachments + * + * @return \Flat\APIClient\Model\MediaAttachment[] + */ + public function getAttachments(): array + { + return $this->container['attachments']; + } + + /** + * Sets attachments + * + * @param \Flat\APIClient\Model\MediaAttachment[] $attachments Reference material handed to the students with the assignment: scores, videos, links and Drive files. A score attached here is the one each student receives their own copy of. + * + * @return $this + */ + public function setAttachments(array $attachments): static + { + if (is_null($attachments)) { + throw new InvalidArgumentException('non-nullable attachments cannot be null'); + } + $this->container['attachments'] = $attachments; + + return $this; + } + + /** + * Gets use_dedicated_attachments + * + * @return bool|null + */ + public function getUseDedicatedAttachments(): ?bool + { + return $this->container['use_dedicated_attachments']; + } + + /** + * Sets use_dedicated_attachments + * + * @param bool|null $use_dedicated_attachments For all assignments created after 02/2023, all the underlying resources must be dedicated and stored in the assignment. This boolean indicates that this assignment only supports dedicated attachments. + * + * @return $this + */ + public function setUseDedicatedAttachments(?bool $use_dedicated_attachments): static + { + if (is_null($use_dedicated_attachments)) { + throw new InvalidArgumentException('non-nullable use_dedicated_attachments cannot be null'); + } + $this->container['use_dedicated_attachments'] = $use_dedicated_attachments; + + return $this; + } + + /** + * Gets max_points + * + * @return float|null + */ + public function getMaxPoints(): ?float + { + return $this->container['max_points']; + } + + /** + * Sets max_points + * + * @param float|null $max_points If set, the grading will be enabled for the assignement + * + * @return $this + */ + public function setMaxPoints(?float $max_points): static + { + if (is_null($max_points)) { + throw new InvalidArgumentException('non-nullable max_points cannot be null'); + } + $this->container['max_points'] = $max_points; + + return $this; + } + + /** + * Gets release_grades + * + * @return string|null + */ + public function getReleaseGrades(): ?string + { + return $this->container['release_grades']; + } + + /** + * Sets release_grades + * + * @param string|null $release_grades For worksheets, how grading will work for the assignment: - If set to `auto`, the grades will be automatically released when the student submits the submissions - If set to `manual`, the grades will only be set as `draftGrade` and will be released when the teacher returns the submissions + * + * @return $this + */ + public function setReleaseGrades(?string $release_grades): static + { + if (is_null($release_grades)) { + throw new InvalidArgumentException('non-nullable release_grades cannot be null'); + } + $allowedValues = self::getReleaseGradesAllowableValues(); + if (!in_array($release_grades, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'release_grades', must be one of '%s'", + $release_grades, + implode("', '", $allowedValues) + ) + ); + } + $this->container['release_grades'] = $release_grades; + + return $this; + } + + /** + * Gets shuffle_exercises + * + * @return bool|null + */ + public function getShuffleExercises(): ?bool + { + return $this->container['shuffle_exercises']; + } + + /** + * Sets shuffle_exercises + * + * @param bool|null $shuffle_exercises Mixing worksheets exercises for each student + * + * @return $this + */ + public function setShuffleExercises(?bool $shuffle_exercises): static + { + if (is_null($shuffle_exercises)) { + throw new InvalidArgumentException('non-nullable shuffle_exercises cannot be null'); + } + $this->container['shuffle_exercises'] = $shuffle_exercises; + + return $this; + } + + /** + * Gets toolset + * + * @return string|null + */ + public function getToolset(): ?string + { + return $this->container['toolset']; + } + + /** + * Sets toolset + * + * @param string|null $toolset The id of the associated toolset + * + * @return $this + */ + public function setToolset(?string $toolset): static + { + if (is_null($toolset)) { + throw new InvalidArgumentException('non-nullable toolset cannot be null'); + } + $this->container['toolset'] = $toolset; + + return $this; + } + + /** + * Gets nb_playback_authorized + * + * @return float|null + */ + public function getNbPlaybackAuthorized(): ?float + { + return $this->container['nb_playback_authorized']; + } + + /** + * Sets nb_playback_authorized + * + * @param float|null $nb_playback_authorized The number of playback authorized on the scores of the assignment. + * + * @return $this + */ + public function setNbPlaybackAuthorized(?float $nb_playback_authorized): static + { + if (is_null($nb_playback_authorized)) { + throw new InvalidArgumentException('non-nullable nb_playback_authorized cannot be null'); + } + $this->container['nb_playback_authorized'] = $nb_playback_authorized; + + return $this; + } + + /** + * Gets restrict_play_note + * + * @return bool|null + */ + public function getRestrictPlayNote(): ?bool + { + return $this->container['restrict_play_note']; + } + + /** + * Sets restrict_play_note + * + * @param bool|null $restrict_play_note Restrict the ability to get an audio feedback every time a student adds or selects a note. + * + * @return $this + */ + public function setRestrictPlayNote(?bool $restrict_play_note): static + { + if (is_null($restrict_play_note)) { + throw new InvalidArgumentException('non-nullable restrict_play_note cannot be null'); + } + $this->container['restrict_play_note'] = $restrict_play_note; + + return $this; + } + + /** + * Gets restrict_to_audio_tracks + * + * @return bool|null + */ + public function getRestrictToAudioTracks(): ?bool + { + return $this->container['restrict_to_audio_tracks']; + } + + /** + * Sets restrict_to_audio_tracks + * + * @param bool|null $restrict_to_audio_tracks Restrict the audio source to provided audio tracks on a score. Students won't be able to use the editor playback. + * + * @return $this + */ + public function setRestrictToAudioTracks(?bool $restrict_to_audio_tracks): static + { + if (is_null($restrict_to_audio_tracks)) { + throw new InvalidArgumentException('non-nullable restrict_to_audio_tracks cannot be null'); + } + $this->container['restrict_to_audio_tracks'] = $restrict_to_audio_tracks; + + return $this; + } + + /** + * Gets submission_students_mode + * + * @return \Flat\APIClient\Model\AssignmentSubmissionStudentsMode|null + */ + public function getSubmissionStudentsMode(): ?\Flat\APIClient\Model\AssignmentSubmissionStudentsMode + { + return $this->container['submission_students_mode']; + } + + /** + * Sets submission_students_mode + * + * @param \Flat\APIClient\Model\AssignmentSubmissionStudentsMode|null $submission_students_mode submission_students_mode + * + * @return $this + */ + public function setSubmissionStudentsMode(?\Flat\APIClient\Model\AssignmentSubmissionStudentsMode $submission_students_mode): static + { + if (is_null($submission_students_mode)) { + throw new InvalidArgumentException('non-nullable submission_students_mode cannot be null'); + } + $this->container['submission_students_mode'] = $submission_students_mode; + + return $this; + } + + /** + * Gets recording_type + * + * @return string|null + */ + public function getRecordingType(): ?string + { + return $this->container['recording_type']; + } + + /** + * Sets recording_type + * + * @param string|null $recording_type For performance assignments: recording type that will be either 'audio' or 'video'. * `audio`: Only audio will be required during the recording. * `video`: Camera will be required during the recording. Only set when type is 'performance'. + * + * @return $this + */ + public function setRecordingType(?string $recording_type): static + { + if (is_null($recording_type)) { + throw new InvalidArgumentException('non-nullable recording_type cannot be null'); + } + $allowedValues = self::getRecordingTypeAllowableValues(); + if (!in_array($recording_type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'recording_type', must be one of '%s'", + $recording_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['recording_type'] = $recording_type; + + return $this; + } + + /** + * Gets allow_metronome + * + * @return bool|null + */ + public function getAllowMetronome(): ?bool + { + return $this->container['allow_metronome']; + } + + /** + * Sets allow_metronome + * + * @param bool|null $allow_metronome For performance assignments: Enable students to use the metronome while they are recording, helping them stay in time. Only set when type is 'performance'. + * + * @return $this + */ + public function setAllowMetronome(?bool $allow_metronome): static + { + if (is_null($allow_metronome)) { + throw new InvalidArgumentException('non-nullable allow_metronome cannot be null'); + } + $this->container['allow_metronome'] = $allow_metronome; + + return $this; + } + + /** + * Gets allow_backing_track + * + * @return bool|null + */ + public function getAllowBackingTrack(): ?bool + { + return $this->container['allow_backing_track']; + } + + /** + * Sets allow_backing_track + * + * @param bool|null $allow_backing_track For performance assignments: Enable students to listen to the accompaniment without their instrument part while they are playing. Only set when type is 'performance'. + * + * @return $this + */ + public function setAllowBackingTrack(?bool $allow_backing_track): static + { + if (is_null($allow_backing_track)) { + throw new InvalidArgumentException('non-nullable allow_backing_track cannot be null'); + } + $this->container['allow_backing_track'] = $allow_backing_track; + + return $this; + } + + /** + * Gets allow_speed_change + * + * @return bool|null + */ + public function getAllowSpeedChange(): ?bool + { + return $this->container['allow_speed_change']; + } + + /** + * Sets allow_speed_change + * + * @param bool|null $allow_speed_change For performance assignments: whether students can adjust the playback speed of the score during recording. * `true`: Students can change the tempo/speed during practice and recording * `false`: Tempo is fixed to the original score tempo Only set when type is 'performance'. + * + * @return $this + */ + public function setAllowSpeedChange(?bool $allow_speed_change): static + { + if (is_null($allow_speed_change)) { + throw new InvalidArgumentException('non-nullable allow_speed_change cannot be null'); + } + $this->container['allow_speed_change'] = $allow_speed_change; + + return $this; + } + + /** + * Gets free_record + * + * @return bool|null + */ + public function getFreeRecord(): ?bool + { + return $this->container['free_record']; + } + + /** + * Sets free_record + * + * @param bool|null $free_record For performance assignments: \"Free Record\" mode. When `true`, no score is attached to the assignment. Students freely record a varied repertoire or an ensemble performance without being constrained by a single score's structure or duration, and all score-dependent options (playback, metronome, backtracking, speed control) are hidden. Only set when type is 'performance'. + * + * @return $this + */ + public function setFreeRecord(?bool $free_record): static + { + if (is_null($free_record)) { + throw new InvalidArgumentException('non-nullable free_record cannot be null'); + } + $this->container['free_record'] = $free_record; + + return $this; + } + + /** + * Gets creator + * + * @return string|null + */ + public function getCreator(): ?string + { + return $this->container['creator']; + } + + /** + * Sets creator + * + * @param string|null $creator The User unique identifier of the creator of this assignment + * + * @return $this + */ + public function setCreator(?string $creator): static + { + if (is_null($creator)) { + throw new InvalidArgumentException('non-nullable creator cannot be null'); + } + $this->container['creator'] = $creator; + + return $this; + } + + /** + * Gets state + * + * @return string + */ + public function getState(): string + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string $state State of the assignment + * + * @return $this + */ + public function setState(string $state): static + { + if (is_null($state)) { + throw new InvalidArgumentException('non-nullable state cannot be null'); + } + $allowedValues = self::getStateAllowableValues(); + if (!in_array($state, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'state', must be one of '%s'", + $state, + implode("', '", $allowedValues) + ) + ); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets classroom + * + * @return string|null + */ + public function getClassroom(): ?string + { + return $this->container['classroom']; + } + + /** + * Sets classroom + * + * @param string|null $classroom The unique identifier of the class where this assignment was posted + * + * @return $this + */ + public function setClassroom(?string $classroom): static + { + if (is_null($classroom)) { + throw new InvalidArgumentException('non-nullable classroom cannot be null'); + } + $this->container['classroom'] = $classroom; + + return $this; + } + + /** + * Gets creation_date + * + * @return \DateTime + */ + public function getCreationDate(): \DateTime + { + return $this->container['creation_date']; + } + + /** + * Sets creation_date + * + * @param \DateTime $creation_date The creation date of this assignment + * + * @return $this + */ + public function setCreationDate(\DateTime $creation_date): static + { + if (is_null($creation_date)) { + throw new InvalidArgumentException('non-nullable creation_date cannot be null'); + } + $this->container['creation_date'] = $creation_date; + + return $this; + } + + /** + * Gets scheduled_date + * + * @return \DateTime|null + */ + public function getScheduledDate(): ?\DateTime + { + return $this->container['scheduled_date']; + } + + /** + * Sets scheduled_date + * + * @param \DateTime|null $scheduled_date The publication (scheduled) date of the assignment. If this one is specified, the assignment will only be listed to the teachers of the class. + * + * @return $this + */ + public function setScheduledDate(?\DateTime $scheduled_date): static + { + if (is_null($scheduled_date)) { + throw new InvalidArgumentException('non-nullable scheduled_date cannot be null'); + } + $this->container['scheduled_date'] = $scheduled_date; + + return $this; + } + + /** + * Gets due_date + * + * @return \DateTime|null + */ + public function getDueDate(): ?\DateTime + { + return $this->container['due_date']; + } + + /** + * Sets due_date + * + * @param \DateTime|null $due_date The due date of this assignment, late submissions will be marked as paste due. + * + * @return $this + */ + public function setDueDate(?\DateTime $due_date): static + { + if (is_null($due_date)) { + throw new InvalidArgumentException('non-nullable due_date cannot be null'); + } + $this->container['due_date'] = $due_date; + + return $this; + } + + /** + * Gets assignee_mode + * + * @return string|null + */ + public function getAssigneeMode(): ?string + { + return $this->container['assignee_mode']; + } + + /** + * Sets assignee_mode + * + * @param string|null $assignee_mode Possible modes of assigning assignments + * + * @return $this + */ + public function setAssigneeMode(?string $assignee_mode): static + { + if (is_null($assignee_mode)) { + throw new InvalidArgumentException('non-nullable assignee_mode cannot be null'); + } + $allowedValues = self::getAssigneeModeAllowableValues(); + if (!in_array($assignee_mode, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'assignee_mode', must be one of '%s'", + $assignee_mode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['assignee_mode'] = $assignee_mode; + + return $this; + } + + /** + * Gets assigned_students + * + * @return string[]|null + */ + public function getAssignedStudents(): ?array + { + return $this->container['assigned_students']; + } + + /** + * Sets assigned_students + * + * @param string[]|null $assigned_students Identifiers for the students that have access to the assignment + * + * @return $this + */ + public function setAssignedStudents(?array $assigned_students): static + { + if (is_null($assigned_students)) { + throw new InvalidArgumentException('non-nullable assigned_students cannot be null'); + } + $this->container['assigned_students'] = $assigned_students; + + return $this; + } + + /** + * Gets assigned_groups + * + * @return \Flat\APIClient\Model\AssignmentGroup[]|null + */ + public function getAssignedGroups(): ?array + { + return $this->container['assigned_groups']; + } + + /** + * Sets assigned_groups + * + * @param \Flat\APIClient\Model\AssignmentGroup[]|null $assigned_groups Groups that have access to the assignment (for shared writing assignments) + * + * @return $this + */ + public function setAssignedGroups(?array $assigned_groups): static + { + if (is_null($assigned_groups)) { + throw new InvalidArgumentException('non-nullable assigned_groups cannot be null'); + } + $this->container['assigned_groups'] = $assigned_groups; + + return $this; + } + + /** + * Gets submissions + * + * @return \Flat\APIClient\Model\AssignmentSubmission[] + */ + public function getSubmissions(): array + { + return $this->container['submissions']; + } + + /** + * Sets submissions + * + * @param \Flat\APIClient\Model\AssignmentSubmission[] $submissions submissions + * + * @return $this + */ + public function setSubmissions(array $submissions): static + { + if (is_null($submissions)) { + throw new InvalidArgumentException('non-nullable submissions cannot be null'); + } + $this->container['submissions'] = $submissions; + + return $this; + } + + /** + * Gets google_classroom + * + * @return \Flat\APIClient\Model\GoogleClassroomCoursework|null + */ + public function getGoogleClassroom(): ?\Flat\APIClient\Model\GoogleClassroomCoursework + { + return $this->container['google_classroom']; + } + + /** + * Sets google_classroom + * + * @param \Flat\APIClient\Model\GoogleClassroomCoursework|null $google_classroom google_classroom + * + * @return $this + */ + public function setGoogleClassroom(?\Flat\APIClient\Model\GoogleClassroomCoursework $google_classroom): static + { + if (is_null($google_classroom)) { + throw new InvalidArgumentException('non-nullable google_classroom cannot be null'); + } + $this->container['google_classroom'] = $google_classroom; + + return $this; + } + + /** + * Gets microsoft_graph + * + * @return \Flat\APIClient\Model\MicrosoftGraphAssignment|null + */ + public function getMicrosoftGraph(): ?\Flat\APIClient\Model\MicrosoftGraphAssignment + { + return $this->container['microsoft_graph']; + } + + /** + * Sets microsoft_graph + * + * @param \Flat\APIClient\Model\MicrosoftGraphAssignment|null $microsoft_graph microsoft_graph + * + * @return $this + */ + public function setMicrosoftGraph(?\Flat\APIClient\Model\MicrosoftGraphAssignment $microsoft_graph): static + { + if (is_null($microsoft_graph)) { + throw new InvalidArgumentException('non-nullable microsoft_graph cannot be null'); + } + $this->container['microsoft_graph'] = $microsoft_graph; + + return $this; + } + + /** + * Gets mfc + * + * @return \Flat\APIClient\Model\ClassAssignmentAllOfMfc|null + */ + public function getMfc(): ?\Flat\APIClient\Model\ClassAssignmentAllOfMfc + { + return $this->container['mfc']; + } + + /** + * Sets mfc + * + * @param \Flat\APIClient\Model\ClassAssignmentAllOfMfc|null $mfc mfc + * + * @return $this + */ + public function setMfc(?\Flat\APIClient\Model\ClassAssignmentAllOfMfc $mfc): static + { + if (is_null($mfc)) { + throw new InvalidArgumentException('non-nullable mfc cannot be null'); + } + $this->container['mfc'] = $mfc; + + return $this; + } + + /** + * Gets canvas + * + * @return \Flat\APIClient\Model\ClassAssignmentAllOfCanvas|null + */ + public function getCanvas(): ?\Flat\APIClient\Model\ClassAssignmentAllOfCanvas + { + return $this->container['canvas']; + } + + /** + * Sets canvas + * + * @param \Flat\APIClient\Model\ClassAssignmentAllOfCanvas|null $canvas canvas + * + * @return $this + */ + public function setCanvas(?\Flat\APIClient\Model\ClassAssignmentAllOfCanvas $canvas): static + { + if (is_null($canvas)) { + throw new InvalidArgumentException('non-nullable canvas cannot be null'); + } + $this->container['canvas'] = $canvas; + + return $this; + } + + /** + * Gets lti + * + * @return \Flat\APIClient\Model\ClassAssignmentAllOfLti|null + */ + public function getLti(): ?\Flat\APIClient\Model\ClassAssignmentAllOfLti + { + return $this->container['lti']; + } + + /** + * Sets lti + * + * @param \Flat\APIClient\Model\ClassAssignmentAllOfLti|null $lti lti + * + * @return $this + */ + public function setLti(?\Flat\APIClient\Model\ClassAssignmentAllOfLti $lti): static + { + if (is_null($lti)) { + throw new InvalidArgumentException('non-nullable lti cannot be null'); + } + $this->container['lti'] = $lti; + + return $this; + } + + /** + * Gets issue + * + * @return string|null + */ + public function getIssue(): ?string + { + return $this->container['issue']; + } + + /** + * Sets issue + * + * @param string|null $issue Detected issue for this assignment + * + * @return $this + */ + public function setIssue(?string $issue): static + { + if (is_null($issue)) { + throw new InvalidArgumentException('non-nullable issue cannot be null'); + } + $this->container['issue'] = $issue; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ClassAssignmentAllOfCanvas.php b/src/Model/ClassAssignmentAllOfCanvas.php new file mode 100644 index 0000000..a819c28 --- /dev/null +++ b/src/Model/ClassAssignmentAllOfCanvas.php @@ -0,0 +1,419 @@ + + */ +class ClassAssignmentAllOfCanvas implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ClassAssignment_allOf_canvas'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'alternate_link' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'alternate_link' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'alternate_link' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'alternate_link' => 'alternateLink' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'alternate_link' => 'setAlternateLink' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'alternate_link' => 'getAlternateLink' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('alternate_link', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique identifier of the course on Canvas assignment + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets alternate_link + * + * @return string|null + */ + public function getAlternateLink(): ?string + { + return $this->container['alternate_link']; + } + + /** + * Sets alternate_link + * + * @param string|null $alternate_link Link to Canvas assignment + * + * @return $this + */ + public function setAlternateLink(?string $alternate_link): static + { + if (is_null($alternate_link)) { + throw new InvalidArgumentException('non-nullable alternate_link cannot be null'); + } + $this->container['alternate_link'] = $alternate_link; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ClassAssignmentAllOfLti.php b/src/Model/ClassAssignmentAllOfLti.php new file mode 100644 index 0000000..8dad80d --- /dev/null +++ b/src/Model/ClassAssignmentAllOfLti.php @@ -0,0 +1,385 @@ + + */ +class ClassAssignmentAllOfLti implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ClassAssignment_allOf_lti'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Resource ID in the LMS + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ClassAssignmentAllOfMfc.php b/src/Model/ClassAssignmentAllOfMfc.php new file mode 100644 index 0000000..d11021b --- /dev/null +++ b/src/Model/ClassAssignmentAllOfMfc.php @@ -0,0 +1,419 @@ + + */ +class ClassAssignmentAllOfMfc implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ClassAssignment_allOf_mfc'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'alternate_link' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'alternate_link' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'alternate_link' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'alternate_link' => 'alternateLink' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'alternate_link' => 'setAlternateLink' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'alternate_link' => 'getAlternateLink' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('alternate_link', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique identifier of the course on MusicFirst Task + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets alternate_link + * + * @return string|null + */ + public function getAlternateLink(): ?string + { + return $this->container['alternate_link']; + } + + /** + * Sets alternate_link + * + * @param string|null $alternate_link Link to MusicFirst Classroom task + * + * @return $this + */ + public function setAlternateLink(?string $alternate_link): static + { + if (is_null($alternate_link)) { + throw new InvalidArgumentException('non-nullable alternate_link cannot be null'); + } + $this->container['alternate_link'] = $alternate_link; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ClassAssignmentUpdate.php b/src/Model/ClassAssignmentUpdate.php new file mode 100644 index 0000000..4563a8d --- /dev/null +++ b/src/Model/ClassAssignmentUpdate.php @@ -0,0 +1,1589 @@ + + */ +class ClassAssignmentUpdate implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ClassAssignmentUpdate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => '\Flat\APIClient\Model\AssignmentType', + 'title' => 'string', + 'description' => 'string', + 'description_html' => 'string', + 'teacher_instructions' => 'string', + 'teacher_instructions_html' => 'string', + 'attachments' => '\Flat\APIClient\Model\ClassAttachmentCreation[]', + 'nb_playback_authorized' => 'float', + 'restrict_play_note' => 'bool', + 'restrict_to_audio_tracks' => 'bool', + 'toolset' => 'string', + 'cover_file' => 'string', + 'cover' => 'string', + 'max_points' => 'float', + 'release_grades' => 'string', + 'shuffle_exercises' => 'bool', + 'submission_students_mode' => '\Flat\APIClient\Model\AssignmentSubmissionStudentsMode', + 'recording_type' => 'string', + 'allow_metronome' => 'bool', + 'allow_backing_track' => 'bool', + 'allow_speed_change' => 'bool', + 'free_record' => 'bool', + 'state' => 'string', + 'due_date' => '\DateTime', + 'scheduled_date' => '\DateTime', + 'google_classroom' => '\Flat\APIClient\Model\ClassAssignmentUpdateAllOfGoogleClassroom', + 'microsoft_graph' => '\Flat\APIClient\Model\ClassAssignmentUpdateAllOfMicrosoftGraph', + 'assignee_mode' => 'string', + 'assigned_students' => 'string[]', + 'class_group_ids' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'title' => null, + 'description' => null, + 'description_html' => null, + 'teacher_instructions' => null, + 'teacher_instructions_html' => null, + 'attachments' => null, + 'nb_playback_authorized' => null, + 'restrict_play_note' => null, + 'restrict_to_audio_tracks' => null, + 'toolset' => null, + 'cover_file' => null, + 'cover' => null, + 'max_points' => null, + 'release_grades' => null, + 'shuffle_exercises' => null, + 'submission_students_mode' => null, + 'recording_type' => null, + 'allow_metronome' => null, + 'allow_backing_track' => null, + 'allow_speed_change' => null, + 'free_record' => null, + 'state' => null, + 'due_date' => 'date-time', + 'scheduled_date' => 'date-time', + 'google_classroom' => null, + 'microsoft_graph' => null, + 'assignee_mode' => null, + 'assigned_students' => null, + 'class_group_ids' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'title' => false, + 'description' => false, + 'description_html' => false, + 'teacher_instructions' => false, + 'teacher_instructions_html' => false, + 'attachments' => false, + 'nb_playback_authorized' => false, + 'restrict_play_note' => false, + 'restrict_to_audio_tracks' => false, + 'toolset' => false, + 'cover_file' => false, + 'cover' => false, + 'max_points' => false, + 'release_grades' => false, + 'shuffle_exercises' => false, + 'submission_students_mode' => false, + 'recording_type' => false, + 'allow_metronome' => false, + 'allow_backing_track' => false, + 'allow_speed_change' => false, + 'free_record' => false, + 'state' => false, + 'due_date' => true, + 'scheduled_date' => true, + 'google_classroom' => false, + 'microsoft_graph' => false, + 'assignee_mode' => false, + 'assigned_students' => false, + 'class_group_ids' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'title' => 'title', + 'description' => 'description', + 'description_html' => 'descriptionHtml', + 'teacher_instructions' => 'teacherInstructions', + 'teacher_instructions_html' => 'teacherInstructionsHtml', + 'attachments' => 'attachments', + 'nb_playback_authorized' => 'nbPlaybackAuthorized', + 'restrict_play_note' => 'restrictPlayNote', + 'restrict_to_audio_tracks' => 'restrictToAudioTracks', + 'toolset' => 'toolset', + 'cover_file' => 'coverFile', + 'cover' => 'cover', + 'max_points' => 'maxPoints', + 'release_grades' => 'releaseGrades', + 'shuffle_exercises' => 'shuffleExercises', + 'submission_students_mode' => 'submissionStudentsMode', + 'recording_type' => 'recordingType', + 'allow_metronome' => 'allowMetronome', + 'allow_backing_track' => 'allowBackingTrack', + 'allow_speed_change' => 'allowSpeedChange', + 'free_record' => 'freeRecord', + 'state' => 'state', + 'due_date' => 'dueDate', + 'scheduled_date' => 'scheduledDate', + 'google_classroom' => 'googleClassroom', + 'microsoft_graph' => 'microsoftGraph', + 'assignee_mode' => 'assigneeMode', + 'assigned_students' => 'assignedStudents', + 'class_group_ids' => 'classGroupIds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'title' => 'setTitle', + 'description' => 'setDescription', + 'description_html' => 'setDescriptionHtml', + 'teacher_instructions' => 'setTeacherInstructions', + 'teacher_instructions_html' => 'setTeacherInstructionsHtml', + 'attachments' => 'setAttachments', + 'nb_playback_authorized' => 'setNbPlaybackAuthorized', + 'restrict_play_note' => 'setRestrictPlayNote', + 'restrict_to_audio_tracks' => 'setRestrictToAudioTracks', + 'toolset' => 'setToolset', + 'cover_file' => 'setCoverFile', + 'cover' => 'setCover', + 'max_points' => 'setMaxPoints', + 'release_grades' => 'setReleaseGrades', + 'shuffle_exercises' => 'setShuffleExercises', + 'submission_students_mode' => 'setSubmissionStudentsMode', + 'recording_type' => 'setRecordingType', + 'allow_metronome' => 'setAllowMetronome', + 'allow_backing_track' => 'setAllowBackingTrack', + 'allow_speed_change' => 'setAllowSpeedChange', + 'free_record' => 'setFreeRecord', + 'state' => 'setState', + 'due_date' => 'setDueDate', + 'scheduled_date' => 'setScheduledDate', + 'google_classroom' => 'setGoogleClassroom', + 'microsoft_graph' => 'setMicrosoftGraph', + 'assignee_mode' => 'setAssigneeMode', + 'assigned_students' => 'setAssignedStudents', + 'class_group_ids' => 'setClassGroupIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'title' => 'getTitle', + 'description' => 'getDescription', + 'description_html' => 'getDescriptionHtml', + 'teacher_instructions' => 'getTeacherInstructions', + 'teacher_instructions_html' => 'getTeacherInstructionsHtml', + 'attachments' => 'getAttachments', + 'nb_playback_authorized' => 'getNbPlaybackAuthorized', + 'restrict_play_note' => 'getRestrictPlayNote', + 'restrict_to_audio_tracks' => 'getRestrictToAudioTracks', + 'toolset' => 'getToolset', + 'cover_file' => 'getCoverFile', + 'cover' => 'getCover', + 'max_points' => 'getMaxPoints', + 'release_grades' => 'getReleaseGrades', + 'shuffle_exercises' => 'getShuffleExercises', + 'submission_students_mode' => 'getSubmissionStudentsMode', + 'recording_type' => 'getRecordingType', + 'allow_metronome' => 'getAllowMetronome', + 'allow_backing_track' => 'getAllowBackingTrack', + 'allow_speed_change' => 'getAllowSpeedChange', + 'free_record' => 'getFreeRecord', + 'state' => 'getState', + 'due_date' => 'getDueDate', + 'scheduled_date' => 'getScheduledDate', + 'google_classroom' => 'getGoogleClassroom', + 'microsoft_graph' => 'getMicrosoftGraph', + 'assignee_mode' => 'getAssigneeMode', + 'assigned_students' => 'getAssignedStudents', + 'class_group_ids' => 'getClassGroupIds' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const RELEASE_GRADES_AUTO = 'auto'; + public const RELEASE_GRADES_MANUAL = 'manual'; + public const RECORDING_TYPE_AUDIO = 'audio'; + public const RECORDING_TYPE_VIDEO = 'video'; + public const STATE_DRAFT = 'draft'; + public const STATE_ACTIVE = 'active'; + public const ASSIGNEE_MODE_EVERYONE = 'everyone'; + public const ASSIGNEE_MODE_SELECTED = 'selected'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getReleaseGradesAllowableValues() + { + return [ + self::RELEASE_GRADES_AUTO, + self::RELEASE_GRADES_MANUAL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getRecordingTypeAllowableValues() + { + return [ + self::RECORDING_TYPE_AUDIO, + self::RECORDING_TYPE_VIDEO, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getStateAllowableValues() + { + return [ + self::STATE_DRAFT, + self::STATE_ACTIVE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getAssigneeModeAllowableValues() + { + return [ + self::ASSIGNEE_MODE_EVERYONE, + self::ASSIGNEE_MODE_SELECTED, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('description_html', $data ?? [], null); + $this->setIfExists('teacher_instructions', $data ?? [], null); + $this->setIfExists('teacher_instructions_html', $data ?? [], null); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('nb_playback_authorized', $data ?? [], null); + $this->setIfExists('restrict_play_note', $data ?? [], null); + $this->setIfExists('restrict_to_audio_tracks', $data ?? [], null); + $this->setIfExists('toolset', $data ?? [], null); + $this->setIfExists('cover_file', $data ?? [], null); + $this->setIfExists('cover', $data ?? [], null); + $this->setIfExists('max_points', $data ?? [], null); + $this->setIfExists('release_grades', $data ?? [], null); + $this->setIfExists('shuffle_exercises', $data ?? [], null); + $this->setIfExists('submission_students_mode', $data ?? [], null); + $this->setIfExists('recording_type', $data ?? [], null); + $this->setIfExists('allow_metronome', $data ?? [], null); + $this->setIfExists('allow_backing_track', $data ?? [], null); + $this->setIfExists('allow_speed_change', $data ?? [], null); + $this->setIfExists('free_record', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('due_date', $data ?? [], null); + $this->setIfExists('scheduled_date', $data ?? [], null); + $this->setIfExists('google_classroom', $data ?? [], null); + $this->setIfExists('microsoft_graph', $data ?? [], null); + $this->setIfExists('assignee_mode', $data ?? [], null); + $this->setIfExists('assigned_students', $data ?? [], null); + $this->setIfExists('class_group_ids', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['title']) && (mb_strlen($this->container['title']) > 1000)) { + $invalidProperties[] = "invalid value for 'title', the character length must be smaller than or equal to 1000."; + } + + if (!is_null($this->container['title']) && (mb_strlen($this->container['title']) < 1)) { + $invalidProperties[] = "invalid value for 'title', the character length must be bigger than or equal to 1."; + } + + if (!is_null($this->container['description']) && (mb_strlen($this->container['description']) > 100000)) { + $invalidProperties[] = "invalid value for 'description', the character length must be smaller than or equal to 100000."; + } + + if (!is_null($this->container['description_html']) && (mb_strlen($this->container['description_html']) > 20000000)) { + $invalidProperties[] = "invalid value for 'description_html', the character length must be smaller than or equal to 20000000."; + } + + if (!is_null($this->container['teacher_instructions']) && (mb_strlen($this->container['teacher_instructions']) > 100000)) { + $invalidProperties[] = "invalid value for 'teacher_instructions', the character length must be smaller than or equal to 100000."; + } + + if (!is_null($this->container['teacher_instructions_html']) && (mb_strlen($this->container['teacher_instructions_html']) > 20000000)) { + $invalidProperties[] = "invalid value for 'teacher_instructions_html', the character length must be smaller than or equal to 20000000."; + } + + if (!is_null($this->container['max_points']) && ($this->container['max_points'] > 10000)) { + $invalidProperties[] = "invalid value for 'max_points', must be smaller than or equal to 10000."; + } + + if (!is_null($this->container['max_points']) && ($this->container['max_points'] < 0)) { + $invalidProperties[] = "invalid value for 'max_points', must be bigger than or equal to 0."; + } + + $allowedValues = self::getReleaseGradesAllowableValues(); + if (!is_null($this->container['release_grades']) && !in_array($this->container['release_grades'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'release_grades', must be one of '%s'", + $this->container['release_grades'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = self::getRecordingTypeAllowableValues(); + if (!is_null($this->container['recording_type']) && !in_array($this->container['recording_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'recording_type', must be one of '%s'", + $this->container['recording_type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = self::getStateAllowableValues(); + if (!is_null($this->container['state']) && !in_array($this->container['state'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'state', must be one of '%s'", + $this->container['state'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = self::getAssigneeModeAllowableValues(); + if (!is_null($this->container['assignee_mode']) && !in_array($this->container['assignee_mode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'assignee_mode', must be one of '%s'", + $this->container['assignee_mode'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return \Flat\APIClient\Model\AssignmentType|null + */ + public function getType(): ?\Flat\APIClient\Model\AssignmentType + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Flat\APIClient\Model\AssignmentType|null $type type + * + * @return $this + */ + public function setType(?\Flat\APIClient\Model\AssignmentType $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle(): ?string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title Title of the assignment + * + * @return $this + */ + public function setTitle(?string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + if ((mb_strlen($title) > 1000)) { + throw new InvalidArgumentException('invalid length for $title when calling ClassAssignmentUpdate., must be smaller than or equal to 1000.'); + } + if ((mb_strlen($title) < 1)) { + throw new InvalidArgumentException('invalid length for $title when calling ClassAssignmentUpdate., must be bigger than or equal to 1.'); + } + + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Student instructions and content of the assignment (plain text) + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + if ((mb_strlen($description) > 100000)) { + throw new InvalidArgumentException('invalid length for $description when calling ClassAssignmentUpdate., must be smaller than or equal to 100000.'); + } + + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets description_html + * + * @return string|null + */ + public function getDescriptionHtml(): ?string + { + return $this->container['description_html']; + } + + /** + * Sets description_html + * + * @param string|null $description_html HTML version of student instructions. Pasted images may be sent as inline base64 `data:` URIs; they are uploaded to storage and rewritten to hosted URLs on save. The final HTML is limited to 100000 characters. When provided, the plain text version will be automatically extracted for compatibility. + * + * @return $this + */ + public function setDescriptionHtml(?string $description_html): static + { + if (is_null($description_html)) { + throw new InvalidArgumentException('non-nullable description_html cannot be null'); + } + if ((mb_strlen($description_html) > 20000000)) { + throw new InvalidArgumentException('invalid length for $description_html when calling ClassAssignmentUpdate., must be smaller than or equal to 20000000.'); + } + + $this->container['description_html'] = $description_html; + + return $this; + } + + /** + * Gets teacher_instructions + * + * @return string|null + */ + public function getTeacherInstructions(): ?string + { + return $this->container['teacher_instructions']; + } + + /** + * Sets teacher_instructions + * + * @param string|null $teacher_instructions Teacher-only instructions (plain text) + * + * @return $this + */ + public function setTeacherInstructions(?string $teacher_instructions): static + { + if (is_null($teacher_instructions)) { + throw new InvalidArgumentException('non-nullable teacher_instructions cannot be null'); + } + if ((mb_strlen($teacher_instructions) > 100000)) { + throw new InvalidArgumentException('invalid length for $teacher_instructions when calling ClassAssignmentUpdate., must be smaller than or equal to 100000.'); + } + + $this->container['teacher_instructions'] = $teacher_instructions; + + return $this; + } + + /** + * Gets teacher_instructions_html + * + * @return string|null + */ + public function getTeacherInstructionsHtml(): ?string + { + return $this->container['teacher_instructions_html']; + } + + /** + * Sets teacher_instructions_html + * + * @param string|null $teacher_instructions_html HTML version of teacher-only instructions. Pasted images may be sent as inline base64 `data:` URIs; they are uploaded to storage and rewritten to hosted URLs on save. The final HTML is limited to 100000 characters. When provided, the plain text version will be automatically extracted for compatibility. + * + * @return $this + */ + public function setTeacherInstructionsHtml(?string $teacher_instructions_html): static + { + if (is_null($teacher_instructions_html)) { + throw new InvalidArgumentException('non-nullable teacher_instructions_html cannot be null'); + } + if ((mb_strlen($teacher_instructions_html) > 20000000)) { + throw new InvalidArgumentException('invalid length for $teacher_instructions_html when calling ClassAssignmentUpdate., must be smaller than or equal to 20000000.'); + } + + $this->container['teacher_instructions_html'] = $teacher_instructions_html; + + return $this; + } + + /** + * Gets attachments + * + * @return \Flat\APIClient\Model\ClassAttachmentCreation[]|null + */ + public function getAttachments(): ?array + { + return $this->container['attachments']; + } + + /** + * Sets attachments + * + * @param \Flat\APIClient\Model\ClassAttachmentCreation[]|null $attachments The complete attachment list. Omitting this property on an update leaves the existing attachments alone; sending it replaces them. Dropping a dedicated score from the list deletes the students' copies of it, so send the full set you want to keep rather than only the additions. Duplicates, judged by `url`, `score`, `worksheet` or `googleDriveFileId`, are discarded silently, and exceeding the per-assignment limit fails with `ASSIGNMENT_ATTACHMENTS_LIMIT`. + * + * @return $this + */ + public function setAttachments(?array $attachments): static + { + if (is_null($attachments)) { + throw new InvalidArgumentException('non-nullable attachments cannot be null'); + } + $this->container['attachments'] = $attachments; + + return $this; + } + + /** + * Gets nb_playback_authorized + * + * @return float|null + */ + public function getNbPlaybackAuthorized(): ?float + { + return $this->container['nb_playback_authorized']; + } + + /** + * Sets nb_playback_authorized + * + * @param float|null $nb_playback_authorized The number of playback authorized on the scores of the assignment. + * + * @return $this + */ + public function setNbPlaybackAuthorized(?float $nb_playback_authorized): static + { + if (is_null($nb_playback_authorized)) { + throw new InvalidArgumentException('non-nullable nb_playback_authorized cannot be null'); + } + $this->container['nb_playback_authorized'] = $nb_playback_authorized; + + return $this; + } + + /** + * Gets restrict_play_note + * + * @return bool|null + */ + public function getRestrictPlayNote(): ?bool + { + return $this->container['restrict_play_note']; + } + + /** + * Sets restrict_play_note + * + * @param bool|null $restrict_play_note Restrict the ability to get an audio feedback every time a student adds or selects a note. + * + * @return $this + */ + public function setRestrictPlayNote(?bool $restrict_play_note): static + { + if (is_null($restrict_play_note)) { + throw new InvalidArgumentException('non-nullable restrict_play_note cannot be null'); + } + $this->container['restrict_play_note'] = $restrict_play_note; + + return $this; + } + + /** + * Gets restrict_to_audio_tracks + * + * @return bool|null + */ + public function getRestrictToAudioTracks(): ?bool + { + return $this->container['restrict_to_audio_tracks']; + } + + /** + * Sets restrict_to_audio_tracks + * + * @param bool|null $restrict_to_audio_tracks Restrict the audio source to provided audio tracks on a score. Students won't be able to use the editor playback. + * + * @return $this + */ + public function setRestrictToAudioTracks(?bool $restrict_to_audio_tracks): static + { + if (is_null($restrict_to_audio_tracks)) { + throw new InvalidArgumentException('non-nullable restrict_to_audio_tracks cannot be null'); + } + $this->container['restrict_to_audio_tracks'] = $restrict_to_audio_tracks; + + return $this; + } + + /** + * Gets toolset + * + * @return string|null + */ + public function getToolset(): ?string + { + return $this->container['toolset']; + } + + /** + * Sets toolset + * + * @param string|null $toolset The id of the toolset to apply to this assignment. The toolset will be copied to the assignment as a dedicated object to prevent unexpected changes when making modifications to the template toolset. This property can be set to null to delete the linked toolset and switch back to all the tools available for this assignment. + * + * @return $this + */ + public function setToolset(?string $toolset): static + { + if (is_null($toolset)) { + throw new InvalidArgumentException('non-nullable toolset cannot be null'); + } + $this->container['toolset'] = $toolset; + + return $this; + } + + /** + * Gets cover_file + * + * @return string|null + */ + public function getCoverFile(): ?string + { + return $this->container['cover_file']; + } + + /** + * Sets cover_file + * + * @param string|null $cover_file The id of the cover to display + * + * @return $this + */ + public function setCoverFile(?string $cover_file): static + { + if (is_null($cover_file)) { + throw new InvalidArgumentException('non-nullable cover_file cannot be null'); + } + $this->container['cover_file'] = $cover_file; + + return $this; + } + + /** + * Gets cover + * + * @return string|null + */ + public function getCover(): ?string + { + return $this->container['cover']; + } + + /** + * Sets cover + * + * @param string|null $cover The URL of the cover to display + * + * @return $this + */ + public function setCover(?string $cover): static + { + if (is_null($cover)) { + throw new InvalidArgumentException('non-nullable cover cannot be null'); + } + $this->container['cover'] = $cover; + + return $this; + } + + /** + * Gets max_points + * + * @return float|null + */ + public function getMaxPoints(): ?float + { + return $this->container['max_points']; + } + + /** + * Sets max_points + * + * @param float|null $max_points If set, the grading will be enabled for the assignement with this value as the maximum of points + * + * @return $this + */ + public function setMaxPoints(?float $max_points): static + { + if (is_null($max_points)) { + throw new InvalidArgumentException('non-nullable max_points cannot be null'); + } + if (($max_points > 10000)) { + throw new InvalidArgumentException('invalid value for $max_points when calling ClassAssignmentUpdate., must be smaller than or equal to 10000.'); + } + if (($max_points < 0)) { + throw new InvalidArgumentException('invalid value for $max_points when calling ClassAssignmentUpdate., must be bigger than or equal to 0.'); + } + + $this->container['max_points'] = $max_points; + + return $this; + } + + /** + * Gets release_grades + * + * @return string|null + */ + public function getReleaseGrades(): ?string + { + return $this->container['release_grades']; + } + + /** + * Sets release_grades + * + * @param string|null $release_grades For worksheets, how grading will work for the assignment: - If set to `auto`, the grades will be automatically released when the student submits the submissions - If set to `manual`, the grades will only be set as `draftGrade` and will be released when the teacher returns the submissions + * + * @return $this + */ + public function setReleaseGrades(?string $release_grades): static + { + if (is_null($release_grades)) { + throw new InvalidArgumentException('non-nullable release_grades cannot be null'); + } + $allowedValues = self::getReleaseGradesAllowableValues(); + if (!in_array($release_grades, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'release_grades', must be one of '%s'", + $release_grades, + implode("', '", $allowedValues) + ) + ); + } + $this->container['release_grades'] = $release_grades; + + return $this; + } + + /** + * Gets shuffle_exercises + * + * @return bool|null + */ + public function getShuffleExercises(): ?bool + { + return $this->container['shuffle_exercises']; + } + + /** + * Sets shuffle_exercises + * + * @param bool|null $shuffle_exercises Mixing worksheets exercises for each student + * + * @return $this + */ + public function setShuffleExercises(?bool $shuffle_exercises): static + { + if (is_null($shuffle_exercises)) { + throw new InvalidArgumentException('non-nullable shuffle_exercises cannot be null'); + } + $this->container['shuffle_exercises'] = $shuffle_exercises; + + return $this; + } + + /** + * Gets submission_students_mode + * + * @return \Flat\APIClient\Model\AssignmentSubmissionStudentsMode|null + */ + public function getSubmissionStudentsMode(): ?\Flat\APIClient\Model\AssignmentSubmissionStudentsMode + { + return $this->container['submission_students_mode']; + } + + /** + * Sets submission_students_mode + * + * @param \Flat\APIClient\Model\AssignmentSubmissionStudentsMode|null $submission_students_mode submission_students_mode + * + * @return $this + */ + public function setSubmissionStudentsMode(?\Flat\APIClient\Model\AssignmentSubmissionStudentsMode $submission_students_mode): static + { + if (is_null($submission_students_mode)) { + throw new InvalidArgumentException('non-nullable submission_students_mode cannot be null'); + } + $this->container['submission_students_mode'] = $submission_students_mode; + + return $this; + } + + /** + * Gets recording_type + * + * @return string|null + */ + public function getRecordingType(): ?string + { + return $this->container['recording_type']; + } + + /** + * Sets recording_type + * + * @param string|null $recording_type For performance assignments: recording type that will be either 'audio' or 'video'. * `audio`: Only audio will be required during the recording. * `video`: Camera will be required during the recording. Only set when type is 'performance'. + * + * @return $this + */ + public function setRecordingType(?string $recording_type): static + { + if (is_null($recording_type)) { + throw new InvalidArgumentException('non-nullable recording_type cannot be null'); + } + $allowedValues = self::getRecordingTypeAllowableValues(); + if (!in_array($recording_type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'recording_type', must be one of '%s'", + $recording_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['recording_type'] = $recording_type; + + return $this; + } + + /** + * Gets allow_metronome + * + * @return bool|null + */ + public function getAllowMetronome(): ?bool + { + return $this->container['allow_metronome']; + } + + /** + * Sets allow_metronome + * + * @param bool|null $allow_metronome For performance assignments: Enable students to use the metronome while they are recording, helping them stay in time. Only set when type is 'performance'. + * + * @return $this + */ + public function setAllowMetronome(?bool $allow_metronome): static + { + if (is_null($allow_metronome)) { + throw new InvalidArgumentException('non-nullable allow_metronome cannot be null'); + } + $this->container['allow_metronome'] = $allow_metronome; + + return $this; + } + + /** + * Gets allow_backing_track + * + * @return bool|null + */ + public function getAllowBackingTrack(): ?bool + { + return $this->container['allow_backing_track']; + } + + /** + * Sets allow_backing_track + * + * @param bool|null $allow_backing_track For performance assignments: Enable students to listen to the accompaniment without their instrument part while they are playing. Only set when type is 'performance'. + * + * @return $this + */ + public function setAllowBackingTrack(?bool $allow_backing_track): static + { + if (is_null($allow_backing_track)) { + throw new InvalidArgumentException('non-nullable allow_backing_track cannot be null'); + } + $this->container['allow_backing_track'] = $allow_backing_track; + + return $this; + } + + /** + * Gets allow_speed_change + * + * @return bool|null + */ + public function getAllowSpeedChange(): ?bool + { + return $this->container['allow_speed_change']; + } + + /** + * Sets allow_speed_change + * + * @param bool|null $allow_speed_change For performance assignments: whether students can adjust the playback speed of the score during recording. * `true`: Students can change the tempo/speed during practice and recording * `false`: Tempo is fixed to the original score tempo Only set when type is 'performance'. + * + * @return $this + */ + public function setAllowSpeedChange(?bool $allow_speed_change): static + { + if (is_null($allow_speed_change)) { + throw new InvalidArgumentException('non-nullable allow_speed_change cannot be null'); + } + $this->container['allow_speed_change'] = $allow_speed_change; + + return $this; + } + + /** + * Gets free_record + * + * @return bool|null + */ + public function getFreeRecord(): ?bool + { + return $this->container['free_record']; + } + + /** + * Sets free_record + * + * @param bool|null $free_record For performance assignments: \"Free Record\" mode. When `true`, no score is attached to the assignment. Students freely record a varied repertoire or an ensemble performance without being constrained by a single score's structure or duration, and all score-dependent options (playback, metronome, backtracking, speed control) are hidden. Only set when type is 'performance'. + * + * @return $this + */ + public function setFreeRecord(?bool $free_record): static + { + if (is_null($free_record)) { + throw new InvalidArgumentException('non-nullable free_record cannot be null'); + } + $this->container['free_record'] = $free_record; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState(): ?string + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state State of the assignment + * + * @return $this + */ + public function setState(?string $state): static + { + if (is_null($state)) { + throw new InvalidArgumentException('non-nullable state cannot be null'); + } + $allowedValues = self::getStateAllowableValues(); + if (!in_array($state, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'state', must be one of '%s'", + $state, + implode("', '", $allowedValues) + ) + ); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets due_date + * + * @return \DateTime|null + */ + public function getDueDate(): ?\DateTime + { + return $this->container['due_date']; + } + + /** + * Sets due_date + * + * @param \DateTime|null $due_date The due date of this assignment, late submissions will be marked as paste due. If not set, the assignment won't have a due date. + * + * @return $this + */ + public function setDueDate(?\DateTime $due_date): static + { + if (is_null($due_date)) { + array_push($this->openAPINullablesSetToNull, 'due_date'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('due_date', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['due_date'] = $due_date; + + return $this; + } + + /** + * Gets scheduled_date + * + * @return \DateTime|null + */ + public function getScheduledDate(): ?\DateTime + { + return $this->container['scheduled_date']; + } + + /** + * Sets scheduled_date + * + * @param \DateTime|null $scheduled_date The publication (scheduled) date of the assignment. If this one is specified, the assignment will only be listed to the teachers of the class. + * + * @return $this + */ + public function setScheduledDate(?\DateTime $scheduled_date): static + { + if (is_null($scheduled_date)) { + array_push($this->openAPINullablesSetToNull, 'scheduled_date'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('scheduled_date', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['scheduled_date'] = $scheduled_date; + + return $this; + } + + /** + * Gets google_classroom + * + * @return \Flat\APIClient\Model\ClassAssignmentUpdateAllOfGoogleClassroom|null + */ + public function getGoogleClassroom(): ?\Flat\APIClient\Model\ClassAssignmentUpdateAllOfGoogleClassroom + { + return $this->container['google_classroom']; + } + + /** + * Sets google_classroom + * + * @param \Flat\APIClient\Model\ClassAssignmentUpdateAllOfGoogleClassroom|null $google_classroom google_classroom + * + * @return $this + */ + public function setGoogleClassroom(?\Flat\APIClient\Model\ClassAssignmentUpdateAllOfGoogleClassroom $google_classroom): static + { + if (is_null($google_classroom)) { + throw new InvalidArgumentException('non-nullable google_classroom cannot be null'); + } + $this->container['google_classroom'] = $google_classroom; + + return $this; + } + + /** + * Gets microsoft_graph + * + * @return \Flat\APIClient\Model\ClassAssignmentUpdateAllOfMicrosoftGraph|null + */ + public function getMicrosoftGraph(): ?\Flat\APIClient\Model\ClassAssignmentUpdateAllOfMicrosoftGraph + { + return $this->container['microsoft_graph']; + } + + /** + * Sets microsoft_graph + * + * @param \Flat\APIClient\Model\ClassAssignmentUpdateAllOfMicrosoftGraph|null $microsoft_graph microsoft_graph + * + * @return $this + */ + public function setMicrosoftGraph(?\Flat\APIClient\Model\ClassAssignmentUpdateAllOfMicrosoftGraph $microsoft_graph): static + { + if (is_null($microsoft_graph)) { + throw new InvalidArgumentException('non-nullable microsoft_graph cannot be null'); + } + $this->container['microsoft_graph'] = $microsoft_graph; + + return $this; + } + + /** + * Gets assignee_mode + * + * @return string|null + */ + public function getAssigneeMode(): ?string + { + return $this->container['assignee_mode']; + } + + /** + * Sets assignee_mode + * + * @param string|null $assignee_mode Possible modes of assigning assignments + * + * @return $this + */ + public function setAssigneeMode(?string $assignee_mode): static + { + if (is_null($assignee_mode)) { + throw new InvalidArgumentException('non-nullable assignee_mode cannot be null'); + } + $allowedValues = self::getAssigneeModeAllowableValues(); + if (!in_array($assignee_mode, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'assignee_mode', must be one of '%s'", + $assignee_mode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['assignee_mode'] = $assignee_mode; + + return $this; + } + + /** + * Gets assigned_students + * + * @return string[]|null + */ + public function getAssignedStudents(): ?array + { + return $this->container['assigned_students']; + } + + /** + * Sets assigned_students + * + * @param string[]|null $assigned_students Identifiers for the students that have access to the assignment + * + * @return $this + */ + public function setAssignedStudents(?array $assigned_students): static + { + if (is_null($assigned_students)) { + throw new InvalidArgumentException('non-nullable assigned_students cannot be null'); + } + $this->container['assigned_students'] = $assigned_students; + + return $this; + } + + /** + * Gets class_group_ids + * + * @return string[]|null + */ + public function getClassGroupIds(): ?array + { + return $this->container['class_group_ids']; + } + + /** + * Sets class_group_ids + * + * @param string[]|null $class_group_ids Optional list of specific class group IDs to apply to the assignment. When transitioning to active state with group submission mode: - If provided: Only these specific groups will be applied - If not provided: All class groups will be applied, or randomized groups created if none exist + * + * @return $this + */ + public function setClassGroupIds(?array $class_group_ids): static + { + if (is_null($class_group_ids)) { + array_push($this->openAPINullablesSetToNull, 'class_group_ids'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('class_group_ids', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['class_group_ids'] = $class_group_ids; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ClassAssignmentUpdateAllOfGoogleClassroom.php b/src/Model/ClassAssignmentUpdateAllOfGoogleClassroom.php new file mode 100644 index 0000000..47109ce --- /dev/null +++ b/src/Model/ClassAssignmentUpdateAllOfGoogleClassroom.php @@ -0,0 +1,392 @@ + + */ +class ClassAssignmentUpdateAllOfGoogleClassroom implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ClassAssignmentUpdate_allOf_googleClassroom'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'topic_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'topic_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'topic_id' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'topic_id' => 'topicId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'topic_id' => 'setTopicId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'topic_id' => 'getTopicId' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('topic_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets topic_id + * + * @return string|null + */ + public function getTopicId(): ?string + { + return $this->container['topic_id']; + } + + /** + * Sets topic_id + * + * @param string|null $topic_id Identifier of the topic where the assignment is created + * + * @return $this + */ + public function setTopicId(?string $topic_id): static + { + if (is_null($topic_id)) { + array_push($this->openAPINullablesSetToNull, 'topic_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('topic_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['topic_id'] = $topic_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ClassAssignmentUpdateAllOfMicrosoftGraph.php b/src/Model/ClassAssignmentUpdateAllOfMicrosoftGraph.php new file mode 100644 index 0000000..b520a18 --- /dev/null +++ b/src/Model/ClassAssignmentUpdateAllOfMicrosoftGraph.php @@ -0,0 +1,392 @@ + + */ +class ClassAssignmentUpdateAllOfMicrosoftGraph implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ClassAssignmentUpdate_allOf_microsoftGraph'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'categories' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'categories' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'categories' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'categories' => 'categories' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'categories' => 'setCategories' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'categories' => 'getCategories' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('categories', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets categories + * + * @return string[]|null + */ + public function getCategories(): ?array + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param string[]|null $categories List of categories this assignment belongs to + * + * @return $this + */ + public function setCategories(?array $categories): static + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ClassAttachmentCreation.php b/src/Model/ClassAttachmentCreation.php new file mode 100644 index 0000000..86f36ec --- /dev/null +++ b/src/Model/ClassAttachmentCreation.php @@ -0,0 +1,735 @@ + + */ +class ClassAttachmentCreation implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ClassAttachmentCreation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => 'string', + 'score' => 'string', + 'worksheet' => 'string', + 'revision' => 'string', + 'part_uuid' => 'string', + 'sharing_mode' => '\Flat\APIClient\Model\MediaScoreSharingMode', + 'lock_score_template' => 'bool', + 'url' => 'string', + 'google_drive_file_id' => 'string', + 'teacher_only' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'score' => null, + 'worksheet' => null, + 'revision' => null, + 'part_uuid' => null, + 'sharing_mode' => null, + 'lock_score_template' => null, + 'url' => null, + 'google_drive_file_id' => null, + 'teacher_only' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'score' => false, + 'worksheet' => false, + 'revision' => false, + 'part_uuid' => false, + 'sharing_mode' => false, + 'lock_score_template' => false, + 'url' => false, + 'google_drive_file_id' => false, + 'teacher_only' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'score' => 'score', + 'worksheet' => 'worksheet', + 'revision' => 'revision', + 'part_uuid' => 'partUuid', + 'sharing_mode' => 'sharingMode', + 'lock_score_template' => 'lockScoreTemplate', + 'url' => 'url', + 'google_drive_file_id' => 'googleDriveFileId', + 'teacher_only' => 'teacherOnly' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'score' => 'setScore', + 'worksheet' => 'setWorksheet', + 'revision' => 'setRevision', + 'part_uuid' => 'setPartUuid', + 'sharing_mode' => 'setSharingMode', + 'lock_score_template' => 'setLockScoreTemplate', + 'url' => 'setUrl', + 'google_drive_file_id' => 'setGoogleDriveFileId', + 'teacher_only' => 'setTeacherOnly' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'score' => 'getScore', + 'worksheet' => 'getWorksheet', + 'revision' => 'getRevision', + 'part_uuid' => 'getPartUuid', + 'sharing_mode' => 'getSharingMode', + 'lock_score_template' => 'getLockScoreTemplate', + 'url' => 'getUrl', + 'google_drive_file_id' => 'getGoogleDriveFileId', + 'teacher_only' => 'getTeacherOnly' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const TYPE_RICH = 'rich'; + public const TYPE_PHOTO = 'photo'; + public const TYPE_VIDEO = 'video'; + public const TYPE_LINK = 'link'; + public const TYPE_FLAT = 'flat'; + public const TYPE_GOOGLE_DRIVE = 'googleDrive'; + public const TYPE_WORKSHEET = 'worksheet'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getTypeAllowableValues() + { + return [ + self::TYPE_RICH, + self::TYPE_PHOTO, + self::TYPE_VIDEO, + self::TYPE_LINK, + self::TYPE_FLAT, + self::TYPE_GOOGLE_DRIVE, + self::TYPE_WORKSHEET, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('score', $data ?? [], null); + $this->setIfExists('worksheet', $data ?? [], null); + $this->setIfExists('revision', $data ?? [], null); + $this->setIfExists('part_uuid', $data ?? [], null); + $this->setIfExists('sharing_mode', $data ?? [], null); + $this->setIfExists('lock_score_template', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('google_drive_file_id', $data ?? [], null); + $this->setIfExists('teacher_only', $data ?? [], false); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = self::getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string|null + */ + public function getType(): ?string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type The type of the attachment posted: * `rich`, `photo`, `video` are attachment types that are automatically resolved from a `link` attachment. * A `flat` attachment is a score document where the unique identifier will be specified in the `score` property. Its sharing mode will be provided in the `sharingMode` property. + * + * @return $this + */ + public function setType(?string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = self::getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets score + * + * @return string|null + */ + public function getScore(): ?string + { + return $this->container['score']; + } + + /** + * Sets score + * + * @param string|null $score A unique Flat score identifier. The user creating the assignment must at least have read access to the document. If the user has admin rights, new group permissions will be automatically added for the teachers and students of the class. + * + * @return $this + */ + public function setScore(?string $score): static + { + if (is_null($score)) { + throw new InvalidArgumentException('non-nullable score cannot be null'); + } + $this->container['score'] = $score; + + return $this; + } + + /** + * Gets worksheet + * + * @return string|null + */ + public function getWorksheet(): ?string + { + return $this->container['worksheet']; + } + + /** + * Sets worksheet + * + * @param string|null $worksheet An unique worksheet identifier + * + * @return $this + */ + public function setWorksheet(?string $worksheet): static + { + if (is_null($worksheet)) { + throw new InvalidArgumentException('non-nullable worksheet cannot be null'); + } + $this->container['worksheet'] = $worksheet; + + return $this; + } + + /** + * Gets revision + * + * @return string|null + */ + public function getRevision(): ?string + { + return $this->container['revision']; + } + + /** + * Sets revision + * + * @param string|null $revision An unique revision identifier of a score + * + * @return $this + */ + public function setRevision(?string $revision): static + { + if (is_null($revision)) { + throw new InvalidArgumentException('non-nullable revision cannot be null'); + } + $this->container['revision'] = $revision; + + return $this; + } + + /** + * Gets part_uuid + * + * @return string|null + */ + public function getPartUuid(): ?string + { + return $this->container['part_uuid']; + } + + /** + * Sets part_uuid + * + * @param string|null $part_uuid The UUID of the instrument part selected for this attachment (for performance submissions) + * + * @return $this + */ + public function setPartUuid(?string $part_uuid): static + { + if (is_null($part_uuid)) { + throw new InvalidArgumentException('non-nullable part_uuid cannot be null'); + } + $this->container['part_uuid'] = $part_uuid; + + return $this; + } + + /** + * Gets sharing_mode + * + * @return \Flat\APIClient\Model\MediaScoreSharingMode|null + */ + public function getSharingMode(): ?\Flat\APIClient\Model\MediaScoreSharingMode + { + return $this->container['sharing_mode']; + } + + /** + * Sets sharing_mode + * + * @param \Flat\APIClient\Model\MediaScoreSharingMode|null $sharing_mode sharing_mode + * + * @return $this + */ + public function setSharingMode(?\Flat\APIClient\Model\MediaScoreSharingMode $sharing_mode): static + { + if (is_null($sharing_mode)) { + throw new InvalidArgumentException('non-nullable sharing_mode cannot be null'); + } + $this->container['sharing_mode'] = $sharing_mode; + + return $this; + } + + /** + * Gets lock_score_template + * + * @return bool|null + */ + public function getLockScoreTemplate(): ?bool + { + return $this->container['lock_score_template']; + } + + /** + * Sets lock_score_template + * + * @param bool|null $lock_score_template To be used with a score attached in `sharingMode` `copy` (score used as template). If true, students won't be able to change the original notes of the template. + * + * @return $this + */ + public function setLockScoreTemplate(?bool $lock_score_template): static + { + if (is_null($lock_score_template)) { + throw new InvalidArgumentException('non-nullable lock_score_template cannot be null'); + } + $this->container['lock_score_template'] = $lock_score_template; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl(): ?string + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The URL of the attachment. + * + * @return $this + */ + public function setUrl(?string $url): static + { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets google_drive_file_id + * + * @return string|null + */ + public function getGoogleDriveFileId(): ?string + { + return $this->container['google_drive_file_id']; + } + + /** + * Sets google_drive_file_id + * + * @param string|null $google_drive_file_id The ID of the Google Drive File + * + * @return $this + */ + public function setGoogleDriveFileId(?string $google_drive_file_id): static + { + if (is_null($google_drive_file_id)) { + throw new InvalidArgumentException('non-nullable google_drive_file_id cannot be null'); + } + $this->container['google_drive_file_id'] = $google_drive_file_id; + + return $this; + } + + /** + * Gets teacher_only + * + * @return bool|null + */ + public function getTeacherOnly(): ?bool + { + return $this->container['teacher_only']; + } + + /** + * Sets teacher_only + * + * @param bool|null $teacher_only Flag indicating if this attachment should only be visible to teachers + * + * @return $this + */ + public function setTeacherOnly(?bool $teacher_only): static + { + if (is_null($teacher_only)) { + throw new InvalidArgumentException('non-nullable teacher_only cannot be null'); + } + $this->container['teacher_only'] = $teacher_only; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ClassCreation.php b/src/Model/ClassCreation.php new file mode 100644 index 0000000..a83f7f7 --- /dev/null +++ b/src/Model/ClassCreation.php @@ -0,0 +1,593 @@ + + */ +class ClassCreation implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ClassCreation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'section' => 'string', + 'level' => '\Flat\APIClient\Model\ClassGradeLevel', + 'skills_focused' => 'string[]', + 'size' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'section' => null, + 'level' => null, + 'skills_focused' => null, + 'size' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'section' => false, + 'level' => false, + 'skills_focused' => false, + 'size' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'section' => 'section', + 'level' => 'level', + 'skills_focused' => 'skillsFocused', + 'size' => 'size' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'section' => 'setSection', + 'level' => 'setLevel', + 'skills_focused' => 'setSkillsFocused', + 'size' => 'setSize' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'section' => 'getSection', + 'level' => 'getLevel', + 'skills_focused' => 'getSkillsFocused', + 'size' => 'getSize' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const SKILLS_FOCUSED_NOTATION = 'notation'; + public const SKILLS_FOCUSED_SIGHT_READING = 'sight-reading'; + public const SKILLS_FOCUSED_PERFORMANCE_INSTRUMENTAL = 'performance-instrumental'; + public const SKILLS_FOCUSED_EAR_TRAINING = 'ear-training'; + public const SKILLS_FOCUSED_MUSIC_THEORY = 'music-theory'; + public const SKILLS_FOCUSED_COMPOSITION = 'composition'; + public const SKILLS_FOCUSED_JAZZ_ENSEMBLE = 'jazz-ensemble'; + public const SKILLS_FOCUSED_MUSIC_TECHNOLOGY = 'music-technology'; + public const SKILLS_FOCUSED_OTHER = 'other'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getSkillsFocusedAllowableValues() + { + return [ + self::SKILLS_FOCUSED_NOTATION, + self::SKILLS_FOCUSED_SIGHT_READING, + self::SKILLS_FOCUSED_PERFORMANCE_INSTRUMENTAL, + self::SKILLS_FOCUSED_EAR_TRAINING, + self::SKILLS_FOCUSED_MUSIC_THEORY, + self::SKILLS_FOCUSED_COMPOSITION, + self::SKILLS_FOCUSED_JAZZ_ENSEMBLE, + self::SKILLS_FOCUSED_MUSIC_TECHNOLOGY, + self::SKILLS_FOCUSED_OTHER, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('section', $data ?? [], null); + $this->setIfExists('level', $data ?? [], null); + $this->setIfExists('skills_focused', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ((mb_strlen($this->container['name']) > 255)) { + $invalidProperties[] = "invalid value for 'name', the character length must be smaller than or equal to 255."; + } + + if (!is_null($this->container['section']) && (mb_strlen($this->container['section']) > 255)) { + $invalidProperties[] = "invalid value for 'section', the character length must be smaller than or equal to 255."; + } + + if (!is_null($this->container['size']) && ($this->container['size'] < 0)) { + $invalidProperties[] = "invalid value for 'size', must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName(): string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name The name of the new class + * + * @return $this + */ + public function setName(string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + if ((mb_strlen($name) > 255)) { + throw new InvalidArgumentException('invalid length for $name when calling ClassCreation., must be smaller than or equal to 255.'); + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets section + * + * @return string|null + */ + public function getSection(): ?string + { + return $this->container['section']; + } + + /** + * Sets section + * + * @param string|null $section The section of the new class + * + * @return $this + */ + public function setSection(?string $section): static + { + if (is_null($section)) { + throw new InvalidArgumentException('non-nullable section cannot be null'); + } + if ((mb_strlen($section) > 255)) { + throw new InvalidArgumentException('invalid length for $section when calling ClassCreation., must be smaller than or equal to 255.'); + } + + $this->container['section'] = $section; + + return $this; + } + + /** + * Gets level + * + * @return \Flat\APIClient\Model\ClassGradeLevel|null + */ + public function getLevel(): ?\Flat\APIClient\Model\ClassGradeLevel + { + return $this->container['level']; + } + + /** + * Sets level + * + * @param \Flat\APIClient\Model\ClassGradeLevel|null $level level + * + * @return $this + */ + public function setLevel(?\Flat\APIClient\Model\ClassGradeLevel $level): static + { + if (is_null($level)) { + throw new InvalidArgumentException('non-nullable level cannot be null'); + } + $this->container['level'] = $level; + + return $this; + } + + /** + * Gets skills_focused + * + * @return string[]|null + */ + public function getSkillsFocused(): ?array + { + return $this->container['skills_focused']; + } + + /** + * Sets skills_focused + * + * @param string[]|null $skills_focused Specific skills that will be focused in classroom + * + * @return $this + */ + public function setSkillsFocused(?array $skills_focused): static + { + if (is_null($skills_focused)) { + throw new InvalidArgumentException('non-nullable skills_focused cannot be null'); + } + $allowedValues = self::getSkillsFocusedAllowableValues(); + if (array_diff($skills_focused, $allowedValues)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value for 'skills_focused', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['skills_focused'] = $skills_focused; + + return $this; + } + + /** + * Gets size + * + * @return float|null + */ + public function getSize(): ?float + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param float|null $size Number of students in the classroom + * + * @return $this + */ + public function setSize(?float $size): static + { + if (is_null($size)) { + array_push($this->openAPINullablesSetToNull, 'size'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('size', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($size) && ($size < 0)) { + throw new InvalidArgumentException('invalid value for $size when calling ClassCreation., must be bigger than or equal to 0.'); + } + + $this->container['size'] = $size; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ClassDetails.php b/src/Model/ClassDetails.php new file mode 100644 index 0000000..905374c --- /dev/null +++ b/src/Model/ClassDetails.php @@ -0,0 +1,1258 @@ + + */ +class ClassDetails implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ClassDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'state' => '\Flat\APIClient\Model\ClassState', + 'name' => 'string', + 'section' => 'string', + 'description' => 'string', + 'organization' => 'string', + 'owner' => 'string', + 'creation_date' => '\DateTime', + 'modification_date' => '\DateTime', + 'enrollment_code' => 'string', + 'theme' => 'string', + 'assignments_count' => 'float', + 'students_group' => '\Flat\APIClient\Model\GroupDetails', + 'teachers_group' => '\Flat\APIClient\Model\GroupDetails', + 'issues' => '\Flat\APIClient\Model\ClassDetailsIssues', + 'google_classroom' => '\Flat\APIClient\Model\ClassDetailsGoogleClassroom', + 'google_drive' => '\Flat\APIClient\Model\ClassDetailsGoogleDrive', + 'microsoft_graph' => '\Flat\APIClient\Model\ClassDetailsMicrosoftGraph', + 'lti' => '\Flat\APIClient\Model\ClassDetailsLti', + 'canvas' => '\Flat\APIClient\Model\ClassDetailsCanvas', + 'mfc' => '\Flat\APIClient\Model\ClassDetailsMfc', + 'clever' => '\Flat\APIClient\Model\ClassDetailsClever', + 'level' => '\Flat\APIClient\Model\ClassGradeLevel', + 'skills_focused' => 'string[]', + 'size' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'state' => null, + 'name' => null, + 'section' => null, + 'description' => null, + 'organization' => null, + 'owner' => null, + 'creation_date' => 'date-time', + 'modification_date' => 'date-time', + 'enrollment_code' => null, + 'theme' => null, + 'assignments_count' => null, + 'students_group' => null, + 'teachers_group' => null, + 'issues' => null, + 'google_classroom' => null, + 'google_drive' => null, + 'microsoft_graph' => null, + 'lti' => null, + 'canvas' => null, + 'mfc' => null, + 'clever' => null, + 'level' => null, + 'skills_focused' => null, + 'size' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'state' => false, + 'name' => false, + 'section' => false, + 'description' => false, + 'organization' => false, + 'owner' => false, + 'creation_date' => false, + 'modification_date' => false, + 'enrollment_code' => false, + 'theme' => false, + 'assignments_count' => false, + 'students_group' => false, + 'teachers_group' => false, + 'issues' => false, + 'google_classroom' => false, + 'google_drive' => false, + 'microsoft_graph' => false, + 'lti' => false, + 'canvas' => false, + 'mfc' => false, + 'clever' => false, + 'level' => false, + 'skills_focused' => false, + 'size' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'state' => 'state', + 'name' => 'name', + 'section' => 'section', + 'description' => 'description', + 'organization' => 'organization', + 'owner' => 'owner', + 'creation_date' => 'creationDate', + 'modification_date' => 'modificationDate', + 'enrollment_code' => 'enrollmentCode', + 'theme' => 'theme', + 'assignments_count' => 'assignmentsCount', + 'students_group' => 'studentsGroup', + 'teachers_group' => 'teachersGroup', + 'issues' => 'issues', + 'google_classroom' => 'googleClassroom', + 'google_drive' => 'googleDrive', + 'microsoft_graph' => 'microsoftGraph', + 'lti' => 'lti', + 'canvas' => 'canvas', + 'mfc' => 'mfc', + 'clever' => 'clever', + 'level' => 'level', + 'skills_focused' => 'skillsFocused', + 'size' => 'size' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'state' => 'setState', + 'name' => 'setName', + 'section' => 'setSection', + 'description' => 'setDescription', + 'organization' => 'setOrganization', + 'owner' => 'setOwner', + 'creation_date' => 'setCreationDate', + 'modification_date' => 'setModificationDate', + 'enrollment_code' => 'setEnrollmentCode', + 'theme' => 'setTheme', + 'assignments_count' => 'setAssignmentsCount', + 'students_group' => 'setStudentsGroup', + 'teachers_group' => 'setTeachersGroup', + 'issues' => 'setIssues', + 'google_classroom' => 'setGoogleClassroom', + 'google_drive' => 'setGoogleDrive', + 'microsoft_graph' => 'setMicrosoftGraph', + 'lti' => 'setLti', + 'canvas' => 'setCanvas', + 'mfc' => 'setMfc', + 'clever' => 'setClever', + 'level' => 'setLevel', + 'skills_focused' => 'setSkillsFocused', + 'size' => 'setSize' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'state' => 'getState', + 'name' => 'getName', + 'section' => 'getSection', + 'description' => 'getDescription', + 'organization' => 'getOrganization', + 'owner' => 'getOwner', + 'creation_date' => 'getCreationDate', + 'modification_date' => 'getModificationDate', + 'enrollment_code' => 'getEnrollmentCode', + 'theme' => 'getTheme', + 'assignments_count' => 'getAssignmentsCount', + 'students_group' => 'getStudentsGroup', + 'teachers_group' => 'getTeachersGroup', + 'issues' => 'getIssues', + 'google_classroom' => 'getGoogleClassroom', + 'google_drive' => 'getGoogleDrive', + 'microsoft_graph' => 'getMicrosoftGraph', + 'lti' => 'getLti', + 'canvas' => 'getCanvas', + 'mfc' => 'getMfc', + 'clever' => 'getClever', + 'level' => 'getLevel', + 'skills_focused' => 'getSkillsFocused', + 'size' => 'getSize' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const SKILLS_FOCUSED_NOTATION = 'notation'; + public const SKILLS_FOCUSED_SIGHT_READING = 'sight-reading'; + public const SKILLS_FOCUSED_PERFORMANCE_INSTRUMENTAL = 'performance-instrumental'; + public const SKILLS_FOCUSED_EAR_TRAINING = 'ear-training'; + public const SKILLS_FOCUSED_MUSIC_THEORY = 'music-theory'; + public const SKILLS_FOCUSED_COMPOSITION = 'composition'; + public const SKILLS_FOCUSED_JAZZ_ENSEMBLE = 'jazz-ensemble'; + public const SKILLS_FOCUSED_MUSIC_TECHNOLOGY = 'music-technology'; + public const SKILLS_FOCUSED_OTHER = 'other'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getSkillsFocusedAllowableValues() + { + return [ + self::SKILLS_FOCUSED_NOTATION, + self::SKILLS_FOCUSED_SIGHT_READING, + self::SKILLS_FOCUSED_PERFORMANCE_INSTRUMENTAL, + self::SKILLS_FOCUSED_EAR_TRAINING, + self::SKILLS_FOCUSED_MUSIC_THEORY, + self::SKILLS_FOCUSED_COMPOSITION, + self::SKILLS_FOCUSED_JAZZ_ENSEMBLE, + self::SKILLS_FOCUSED_MUSIC_TECHNOLOGY, + self::SKILLS_FOCUSED_OTHER, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('section', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('organization', $data ?? [], null); + $this->setIfExists('owner', $data ?? [], null); + $this->setIfExists('creation_date', $data ?? [], null); + $this->setIfExists('modification_date', $data ?? [], null); + $this->setIfExists('enrollment_code', $data ?? [], null); + $this->setIfExists('theme', $data ?? [], null); + $this->setIfExists('assignments_count', $data ?? [], null); + $this->setIfExists('students_group', $data ?? [], null); + $this->setIfExists('teachers_group', $data ?? [], null); + $this->setIfExists('issues', $data ?? [], null); + $this->setIfExists('google_classroom', $data ?? [], null); + $this->setIfExists('google_drive', $data ?? [], null); + $this->setIfExists('microsoft_graph', $data ?? [], null); + $this->setIfExists('lti', $data ?? [], null); + $this->setIfExists('canvas', $data ?? [], null); + $this->setIfExists('mfc', $data ?? [], null); + $this->setIfExists('clever', $data ?? [], null); + $this->setIfExists('level', $data ?? [], null); + $this->setIfExists('skills_focused', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['state'] === null) { + $invalidProperties[] = "'state' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['creation_date'] === null) { + $invalidProperties[] = "'creation_date' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The unique identifier of the class + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets state + * + * @return \Flat\APIClient\Model\ClassState + */ + public function getState(): \Flat\APIClient\Model\ClassState + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param \Flat\APIClient\Model\ClassState $state state + * + * @return $this + */ + public function setState(\Flat\APIClient\Model\ClassState $state): static + { + if (is_null($state)) { + throw new InvalidArgumentException('non-nullable state cannot be null'); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName(): string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name The name of the class + * + * @return $this + */ + public function setName(string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets section + * + * @return string|null + */ + public function getSection(): ?string + { + return $this->container['section']; + } + + /** + * Sets section + * + * @param string|null $section The section of the class + * + * @return $this + */ + public function setSection(?string $section): static + { + if (is_null($section)) { + throw new InvalidArgumentException('non-nullable section cannot be null'); + } + $this->container['section'] = $section; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An optionnal description for this class + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets organization + * + * @return string|null + */ + public function getOrganization(): ?string + { + return $this->container['organization']; + } + + /** + * Sets organization + * + * @param string|null $organization The unique identifier of the Organization owning this class + * + * @return $this + */ + public function setOrganization(?string $organization): static + { + if (is_null($organization)) { + throw new InvalidArgumentException('non-nullable organization cannot be null'); + } + $this->container['organization'] = $organization; + + return $this; + } + + /** + * Gets owner + * + * @return string|null + */ + public function getOwner(): ?string + { + return $this->container['owner']; + } + + /** + * Sets owner + * + * @param string|null $owner The unique identifier of the User owning this class + * + * @return $this + */ + public function setOwner(?string $owner): static + { + if (is_null($owner)) { + throw new InvalidArgumentException('non-nullable owner cannot be null'); + } + $this->container['owner'] = $owner; + + return $this; + } + + /** + * Gets creation_date + * + * @return \DateTime + */ + public function getCreationDate(): \DateTime + { + return $this->container['creation_date']; + } + + /** + * Sets creation_date + * + * @param \DateTime $creation_date The date when the class was create + * + * @return $this + */ + public function setCreationDate(\DateTime $creation_date): static + { + if (is_null($creation_date)) { + throw new InvalidArgumentException('non-nullable creation_date cannot be null'); + } + $this->container['creation_date'] = $creation_date; + + return $this; + } + + /** + * Gets modification_date + * + * @return \DateTime|null + */ + public function getModificationDate(): ?\DateTime + { + return $this->container['modification_date']; + } + + /** + * Sets modification_date + * + * @param \DateTime|null $modification_date The date when the class was last modified + * + * @return $this + */ + public function setModificationDate(?\DateTime $modification_date): static + { + if (is_null($modification_date)) { + throw new InvalidArgumentException('non-nullable modification_date cannot be null'); + } + $this->container['modification_date'] = $modification_date; + + return $this; + } + + /** + * Gets enrollment_code + * + * @return string|null + */ + public function getEnrollmentCode(): ?string + { + return $this->container['enrollment_code']; + } + + /** + * Sets enrollment_code + * + * @param string|null $enrollment_code [Teachers only] The enrollment code that can be used by the students to join the class + * + * @return $this + */ + public function setEnrollmentCode(?string $enrollment_code): static + { + if (is_null($enrollment_code)) { + throw new InvalidArgumentException('non-nullable enrollment_code cannot be null'); + } + $this->container['enrollment_code'] = $enrollment_code; + + return $this; + } + + /** + * Gets theme + * + * @return string|null + */ + public function getTheme(): ?string + { + return $this->container['theme']; + } + + /** + * Sets theme + * + * @param string|null $theme The theme identifier using in Flat User Interface + * + * @return $this + */ + public function setTheme(?string $theme): static + { + if (is_null($theme)) { + throw new InvalidArgumentException('non-nullable theme cannot be null'); + } + $this->container['theme'] = $theme; + + return $this; + } + + /** + * Gets assignments_count + * + * @return float|null + */ + public function getAssignmentsCount(): ?float + { + return $this->container['assignments_count']; + } + + /** + * Sets assignments_count + * + * @param float|null $assignments_count The number of assignments created in the class + * + * @return $this + */ + public function setAssignmentsCount(?float $assignments_count): static + { + if (is_null($assignments_count)) { + throw new InvalidArgumentException('non-nullable assignments_count cannot be null'); + } + $this->container['assignments_count'] = $assignments_count; + + return $this; + } + + /** + * Gets students_group + * + * @return \Flat\APIClient\Model\GroupDetails|null + */ + public function getStudentsGroup(): ?\Flat\APIClient\Model\GroupDetails + { + return $this->container['students_group']; + } + + /** + * Sets students_group + * + * @param \Flat\APIClient\Model\GroupDetails|null $students_group students_group + * + * @return $this + */ + public function setStudentsGroup(?\Flat\APIClient\Model\GroupDetails $students_group): static + { + if (is_null($students_group)) { + throw new InvalidArgumentException('non-nullable students_group cannot be null'); + } + $this->container['students_group'] = $students_group; + + return $this; + } + + /** + * Gets teachers_group + * + * @return \Flat\APIClient\Model\GroupDetails|null + */ + public function getTeachersGroup(): ?\Flat\APIClient\Model\GroupDetails + { + return $this->container['teachers_group']; + } + + /** + * Sets teachers_group + * + * @param \Flat\APIClient\Model\GroupDetails|null $teachers_group teachers_group + * + * @return $this + */ + public function setTeachersGroup(?\Flat\APIClient\Model\GroupDetails $teachers_group): static + { + if (is_null($teachers_group)) { + throw new InvalidArgumentException('non-nullable teachers_group cannot be null'); + } + $this->container['teachers_group'] = $teachers_group; + + return $this; + } + + /** + * Gets issues + * + * @return \Flat\APIClient\Model\ClassDetailsIssues|null + */ + public function getIssues(): ?\Flat\APIClient\Model\ClassDetailsIssues + { + return $this->container['issues']; + } + + /** + * Sets issues + * + * @param \Flat\APIClient\Model\ClassDetailsIssues|null $issues issues + * + * @return $this + */ + public function setIssues(?\Flat\APIClient\Model\ClassDetailsIssues $issues): static + { + if (is_null($issues)) { + throw new InvalidArgumentException('non-nullable issues cannot be null'); + } + $this->container['issues'] = $issues; + + return $this; + } + + /** + * Gets google_classroom + * + * @return \Flat\APIClient\Model\ClassDetailsGoogleClassroom|null + */ + public function getGoogleClassroom(): ?\Flat\APIClient\Model\ClassDetailsGoogleClassroom + { + return $this->container['google_classroom']; + } + + /** + * Sets google_classroom + * + * @param \Flat\APIClient\Model\ClassDetailsGoogleClassroom|null $google_classroom google_classroom + * + * @return $this + */ + public function setGoogleClassroom(?\Flat\APIClient\Model\ClassDetailsGoogleClassroom $google_classroom): static + { + if (is_null($google_classroom)) { + throw new InvalidArgumentException('non-nullable google_classroom cannot be null'); + } + $this->container['google_classroom'] = $google_classroom; + + return $this; + } + + /** + * Gets google_drive + * + * @return \Flat\APIClient\Model\ClassDetailsGoogleDrive|null + */ + public function getGoogleDrive(): ?\Flat\APIClient\Model\ClassDetailsGoogleDrive + { + return $this->container['google_drive']; + } + + /** + * Sets google_drive + * + * @param \Flat\APIClient\Model\ClassDetailsGoogleDrive|null $google_drive google_drive + * + * @return $this + */ + public function setGoogleDrive(?\Flat\APIClient\Model\ClassDetailsGoogleDrive $google_drive): static + { + if (is_null($google_drive)) { + throw new InvalidArgumentException('non-nullable google_drive cannot be null'); + } + $this->container['google_drive'] = $google_drive; + + return $this; + } + + /** + * Gets microsoft_graph + * + * @return \Flat\APIClient\Model\ClassDetailsMicrosoftGraph|null + */ + public function getMicrosoftGraph(): ?\Flat\APIClient\Model\ClassDetailsMicrosoftGraph + { + return $this->container['microsoft_graph']; + } + + /** + * Sets microsoft_graph + * + * @param \Flat\APIClient\Model\ClassDetailsMicrosoftGraph|null $microsoft_graph microsoft_graph + * + * @return $this + */ + public function setMicrosoftGraph(?\Flat\APIClient\Model\ClassDetailsMicrosoftGraph $microsoft_graph): static + { + if (is_null($microsoft_graph)) { + throw new InvalidArgumentException('non-nullable microsoft_graph cannot be null'); + } + $this->container['microsoft_graph'] = $microsoft_graph; + + return $this; + } + + /** + * Gets lti + * + * @return \Flat\APIClient\Model\ClassDetailsLti|null + */ + public function getLti(): ?\Flat\APIClient\Model\ClassDetailsLti + { + return $this->container['lti']; + } + + /** + * Sets lti + * + * @param \Flat\APIClient\Model\ClassDetailsLti|null $lti lti + * + * @return $this + */ + public function setLti(?\Flat\APIClient\Model\ClassDetailsLti $lti): static + { + if (is_null($lti)) { + throw new InvalidArgumentException('non-nullable lti cannot be null'); + } + $this->container['lti'] = $lti; + + return $this; + } + + /** + * Gets canvas + * + * @return \Flat\APIClient\Model\ClassDetailsCanvas|null + */ + public function getCanvas(): ?\Flat\APIClient\Model\ClassDetailsCanvas + { + return $this->container['canvas']; + } + + /** + * Sets canvas + * + * @param \Flat\APIClient\Model\ClassDetailsCanvas|null $canvas canvas + * + * @return $this + */ + public function setCanvas(?\Flat\APIClient\Model\ClassDetailsCanvas $canvas): static + { + if (is_null($canvas)) { + throw new InvalidArgumentException('non-nullable canvas cannot be null'); + } + $this->container['canvas'] = $canvas; + + return $this; + } + + /** + * Gets mfc + * + * @return \Flat\APIClient\Model\ClassDetailsMfc|null + */ + public function getMfc(): ?\Flat\APIClient\Model\ClassDetailsMfc + { + return $this->container['mfc']; + } + + /** + * Sets mfc + * + * @param \Flat\APIClient\Model\ClassDetailsMfc|null $mfc mfc + * + * @return $this + */ + public function setMfc(?\Flat\APIClient\Model\ClassDetailsMfc $mfc): static + { + if (is_null($mfc)) { + throw new InvalidArgumentException('non-nullable mfc cannot be null'); + } + $this->container['mfc'] = $mfc; + + return $this; + } + + /** + * Gets clever + * + * @return \Flat\APIClient\Model\ClassDetailsClever|null + */ + public function getClever(): ?\Flat\APIClient\Model\ClassDetailsClever + { + return $this->container['clever']; + } + + /** + * Sets clever + * + * @param \Flat\APIClient\Model\ClassDetailsClever|null $clever clever + * + * @return $this + */ + public function setClever(?\Flat\APIClient\Model\ClassDetailsClever $clever): static + { + if (is_null($clever)) { + throw new InvalidArgumentException('non-nullable clever cannot be null'); + } + $this->container['clever'] = $clever; + + return $this; + } + + /** + * Gets level + * + * @return \Flat\APIClient\Model\ClassGradeLevel|null + */ + public function getLevel(): ?\Flat\APIClient\Model\ClassGradeLevel + { + return $this->container['level']; + } + + /** + * Sets level + * + * @param \Flat\APIClient\Model\ClassGradeLevel|null $level level + * + * @return $this + */ + public function setLevel(?\Flat\APIClient\Model\ClassGradeLevel $level): static + { + if (is_null($level)) { + throw new InvalidArgumentException('non-nullable level cannot be null'); + } + $this->container['level'] = $level; + + return $this; + } + + /** + * Gets skills_focused + * + * @return string[]|null + */ + public function getSkillsFocused(): ?array + { + return $this->container['skills_focused']; + } + + /** + * Sets skills_focused + * + * @param string[]|null $skills_focused Specific skills that will be focused in classroom + * + * @return $this + */ + public function setSkillsFocused(?array $skills_focused): static + { + if (is_null($skills_focused)) { + throw new InvalidArgumentException('non-nullable skills_focused cannot be null'); + } + $allowedValues = self::getSkillsFocusedAllowableValues(); + if (array_diff($skills_focused, $allowedValues)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value for 'skills_focused', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['skills_focused'] = $skills_focused; + + return $this; + } + + /** + * Gets size + * + * @return float|null + */ + public function getSize(): ?float + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param float|null $size Number of students in the classroom + * + * @return $this + */ + public function setSize(?float $size): static + { + if (is_null($size)) { + array_push($this->openAPINullablesSetToNull, 'size'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('size', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['size'] = $size; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ClassDetailsCanvas.php b/src/Model/ClassDetailsCanvas.php new file mode 100644 index 0000000..db9f80c --- /dev/null +++ b/src/Model/ClassDetailsCanvas.php @@ -0,0 +1,419 @@ + + */ +class ClassDetailsCanvas implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ClassDetails_canvas'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'domain' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'domain' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'domain' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'domain' => 'domain' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'domain' => 'setDomain' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'domain' => 'getDomain' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('domain', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique identifier of the course on Canvas + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets domain + * + * @return string|null + */ + public function getDomain(): ?string + { + return $this->container['domain']; + } + + /** + * Sets domain + * + * @param string|null $domain Canvas instance domain (e.g. \"canvas.instructure.com\") + * + * @return $this + */ + public function setDomain(?string $domain): static + { + if (is_null($domain)) { + throw new InvalidArgumentException('non-nullable domain cannot be null'); + } + $this->container['domain'] = $domain; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ClassDetailsClever.php b/src/Model/ClassDetailsClever.php new file mode 100644 index 0000000..23dfe15 --- /dev/null +++ b/src/Model/ClassDetailsClever.php @@ -0,0 +1,641 @@ + + */ +class ClassDetailsClever implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ClassDetails_clever'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'creation_date' => '\DateTime', + 'modification_date' => '\DateTime', + 'subject' => 'string', + 'term_name' => 'string', + 'term_start_date' => '\DateTime', + 'term_end_date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'creation_date' => 'date-time', + 'modification_date' => 'date-time', + 'subject' => null, + 'term_name' => null, + 'term_start_date' => 'date-time', + 'term_end_date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'creation_date' => false, + 'modification_date' => false, + 'subject' => false, + 'term_name' => false, + 'term_start_date' => false, + 'term_end_date' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'creation_date' => 'creationDate', + 'modification_date' => 'modificationDate', + 'subject' => 'subject', + 'term_name' => 'termName', + 'term_start_date' => 'termStartDate', + 'term_end_date' => 'termEndDate' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'creation_date' => 'setCreationDate', + 'modification_date' => 'setModificationDate', + 'subject' => 'setSubject', + 'term_name' => 'setTermName', + 'term_start_date' => 'setTermStartDate', + 'term_end_date' => 'setTermEndDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'creation_date' => 'getCreationDate', + 'modification_date' => 'getModificationDate', + 'subject' => 'getSubject', + 'term_name' => 'getTermName', + 'term_start_date' => 'getTermStartDate', + 'term_end_date' => 'getTermEndDate' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const SUBJECT_ENGLISH_LANGUAGE_ARTS = 'english/language arts'; + public const SUBJECT_MATH = 'math'; + public const SUBJECT_SCIENCE = 'science'; + public const SUBJECT_SOCIAL_STUDIES = 'social studies'; + public const SUBJECT_LANGUAGE = 'language'; + public const SUBJECT_HOMEROOM_ADVISORY = 'homeroom/advisory'; + public const SUBJECT_INTERVENTIONS_ONLINE_LEARNING = 'interventions/online learning'; + public const SUBJECT_TECHNOLOGY_AND_ENGINEERING = 'technology and engineering'; + public const SUBJECT_PE_AND_HEALTH = 'PE and health'; + public const SUBJECT_ARTS_AND_MUSIC = 'arts and music'; + public const SUBJECT_OTHER = 'other'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getSubjectAllowableValues() + { + return [ + self::SUBJECT_ENGLISH_LANGUAGE_ARTS, + self::SUBJECT_MATH, + self::SUBJECT_SCIENCE, + self::SUBJECT_SOCIAL_STUDIES, + self::SUBJECT_LANGUAGE, + self::SUBJECT_HOMEROOM_ADVISORY, + self::SUBJECT_INTERVENTIONS_ONLINE_LEARNING, + self::SUBJECT_TECHNOLOGY_AND_ENGINEERING, + self::SUBJECT_PE_AND_HEALTH, + self::SUBJECT_ARTS_AND_MUSIC, + self::SUBJECT_OTHER, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('creation_date', $data ?? [], null); + $this->setIfExists('modification_date', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('term_name', $data ?? [], null); + $this->setIfExists('term_start_date', $data ?? [], null); + $this->setIfExists('term_end_date', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = self::getSubjectAllowableValues(); + if (!is_null($this->container['subject']) && !in_array($this->container['subject'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'subject', must be one of '%s'", + $this->container['subject'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Clever section unique identifier + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets creation_date + * + * @return \DateTime|null + */ + public function getCreationDate(): ?\DateTime + { + return $this->container['creation_date']; + } + + /** + * Sets creation_date + * + * @param \DateTime|null $creation_date The creation date of the section on clever + * + * @return $this + */ + public function setCreationDate(?\DateTime $creation_date): static + { + if (is_null($creation_date)) { + throw new InvalidArgumentException('non-nullable creation_date cannot be null'); + } + $this->container['creation_date'] = $creation_date; + + return $this; + } + + /** + * Gets modification_date + * + * @return \DateTime|null + */ + public function getModificationDate(): ?\DateTime + { + return $this->container['modification_date']; + } + + /** + * Sets modification_date + * + * @param \DateTime|null $modification_date The last modification date of the section on clever + * + * @return $this + */ + public function setModificationDate(?\DateTime $modification_date): static + { + if (is_null($modification_date)) { + throw new InvalidArgumentException('non-nullable modification_date cannot be null'); + } + $this->container['modification_date'] = $modification_date; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject(): ?string + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject Normalized subject of the course + * + * @return $this + */ + public function setSubject(?string $subject): static + { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } + $allowedValues = self::getSubjectAllowableValues(); + if (!in_array($subject, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'subject', must be one of '%s'", + $subject, + implode("', '", $allowedValues) + ) + ); + } + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets term_name + * + * @return string|null + */ + public function getTermName(): ?string + { + return $this->container['term_name']; + } + + /** + * Sets term_name + * + * @param string|null $term_name Name of the term when this course happens + * + * @return $this + */ + public function setTermName(?string $term_name): static + { + if (is_null($term_name)) { + throw new InvalidArgumentException('non-nullable term_name cannot be null'); + } + $this->container['term_name'] = $term_name; + + return $this; + } + + /** + * Gets term_start_date + * + * @return \DateTime|null + */ + public function getTermStartDate(): ?\DateTime + { + return $this->container['term_start_date']; + } + + /** + * Sets term_start_date + * + * @param \DateTime|null $term_start_date Beginning date of the term + * + * @return $this + */ + public function setTermStartDate(?\DateTime $term_start_date): static + { + if (is_null($term_start_date)) { + throw new InvalidArgumentException('non-nullable term_start_date cannot be null'); + } + $this->container['term_start_date'] = $term_start_date; + + return $this; + } + + /** + * Gets term_end_date + * + * @return \DateTime|null + */ + public function getTermEndDate(): ?\DateTime + { + return $this->container['term_end_date']; + } + + /** + * Sets term_end_date + * + * @param \DateTime|null $term_end_date End date of the term + * + * @return $this + */ + public function setTermEndDate(?\DateTime $term_end_date): static + { + if (is_null($term_end_date)) { + throw new InvalidArgumentException('non-nullable term_end_date cannot be null'); + } + $this->container['term_end_date'] = $term_end_date; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ClassDetailsGoogleClassroom.php b/src/Model/ClassDetailsGoogleClassroom.php new file mode 100644 index 0000000..aecd68c --- /dev/null +++ b/src/Model/ClassDetailsGoogleClassroom.php @@ -0,0 +1,419 @@ + + */ +class ClassDetailsGoogleClassroom implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ClassDetails_googleClassroom'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'alternate_link' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'alternate_link' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'alternate_link' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'alternate_link' => 'alternateLink' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'alternate_link' => 'setAlternateLink' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'alternate_link' => 'getAlternateLink' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('alternate_link', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The course identifier on Google Classroom + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets alternate_link + * + * @return string|null + */ + public function getAlternateLink(): ?string + { + return $this->container['alternate_link']; + } + + /** + * Sets alternate_link + * + * @param string|null $alternate_link Absolute link to this course in the Classroom web UI + * + * @return $this + */ + public function setAlternateLink(?string $alternate_link): static + { + if (is_null($alternate_link)) { + throw new InvalidArgumentException('non-nullable alternate_link cannot be null'); + } + $this->container['alternate_link'] = $alternate_link; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ClassDetailsGoogleDrive.php b/src/Model/ClassDetailsGoogleDrive.php new file mode 100644 index 0000000..076b1c4 --- /dev/null +++ b/src/Model/ClassDetailsGoogleDrive.php @@ -0,0 +1,419 @@ + + */ +class ClassDetailsGoogleDrive implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ClassDetails_googleDrive'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'teacher_folder_id' => 'string', + 'teacher_folder_alternate_link' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'teacher_folder_id' => null, + 'teacher_folder_alternate_link' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'teacher_folder_id' => false, + 'teacher_folder_alternate_link' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'teacher_folder_id' => 'teacherFolderId', + 'teacher_folder_alternate_link' => 'teacherFolderAlternateLink' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'teacher_folder_id' => 'setTeacherFolderId', + 'teacher_folder_alternate_link' => 'setTeacherFolderAlternateLink' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'teacher_folder_id' => 'getTeacherFolderId', + 'teacher_folder_alternate_link' => 'getTeacherFolderAlternateLink' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('teacher_folder_id', $data ?? [], null); + $this->setIfExists('teacher_folder_alternate_link', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets teacher_folder_id + * + * @return string|null + */ + public function getTeacherFolderId(): ?string + { + return $this->container['teacher_folder_id']; + } + + /** + * Sets teacher_folder_id + * + * @param string|null $teacher_folder_id [Teachers only] The Drive directory identifier of the teachers' folder + * + * @return $this + */ + public function setTeacherFolderId(?string $teacher_folder_id): static + { + if (is_null($teacher_folder_id)) { + throw new InvalidArgumentException('non-nullable teacher_folder_id cannot be null'); + } + $this->container['teacher_folder_id'] = $teacher_folder_id; + + return $this; + } + + /** + * Gets teacher_folder_alternate_link + * + * @return string|null + */ + public function getTeacherFolderAlternateLink(): ?string + { + return $this->container['teacher_folder_alternate_link']; + } + + /** + * Sets teacher_folder_alternate_link + * + * @param string|null $teacher_folder_alternate_link [Teachers only] The Drive URL of the teachers' folder + * + * @return $this + */ + public function setTeacherFolderAlternateLink(?string $teacher_folder_alternate_link): static + { + if (is_null($teacher_folder_alternate_link)) { + throw new InvalidArgumentException('non-nullable teacher_folder_alternate_link cannot be null'); + } + $this->container['teacher_folder_alternate_link'] = $teacher_folder_alternate_link; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ClassDetailsIssues.php b/src/Model/ClassDetailsIssues.php new file mode 100644 index 0000000..9727fd5 --- /dev/null +++ b/src/Model/ClassDetailsIssues.php @@ -0,0 +1,385 @@ + + */ +class ClassDetailsIssues implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ClassDetails_issues'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'sync' => '\Flat\APIClient\Model\ClassDetailsIssuesSyncInner[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'sync' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'sync' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'sync' => 'sync' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'sync' => 'setSync' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'sync' => 'getSync' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('sync', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets sync + * + * @return \Flat\APIClient\Model\ClassDetailsIssuesSyncInner[]|null + */ + public function getSync(): ?array + { + return $this->container['sync']; + } + + /** + * Sets sync + * + * @param \Flat\APIClient\Model\ClassDetailsIssuesSyncInner[]|null $sync Synchronization issues for the class + * + * @return $this + */ + public function setSync(?array $sync): static + { + if (is_null($sync)) { + throw new InvalidArgumentException('non-nullable sync cannot be null'); + } + $this->container['sync'] = $sync; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ClassDetailsIssuesSyncInner.php b/src/Model/ClassDetailsIssuesSyncInner.php new file mode 100644 index 0000000..e259edc --- /dev/null +++ b/src/Model/ClassDetailsIssuesSyncInner.php @@ -0,0 +1,489 @@ + + */ +class ClassDetailsIssuesSyncInner implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ClassDetails_issues_sync_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'email' => 'string', + 'reason' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'email' => null, + 'reason' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'email' => false, + 'reason' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'email' => 'email', + 'reason' => 'reason' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'email' => 'setEmail', + 'reason' => 'setReason' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'email' => 'getEmail', + 'reason' => 'getReason' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const REASON_OTHER_ORGNANIZATION = 'otherOrgnanization'; + public const REASON_PRODUCT_MIGRATION = 'productMigration'; + public const REASON_DISABLED_ACCOUNT = 'disabledAccount'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getReasonAllowableValues() + { + return [ + self::REASON_OTHER_ORGNANIZATION, + self::REASON_PRODUCT_MIGRATION, + self::REASON_DISABLED_ACCOUNT, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('reason', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = self::getReasonAllowableValues(); + if (!is_null($this->container['reason']) && !in_array($this->container['reason'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'reason', must be one of '%s'", + $this->container['reason'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The account user identifier + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail(): ?string + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email The email address of the user concerned by this sync issue + * + * @return $this + */ + public function setEmail(?string $email): static + { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets reason + * + * @return string|null + */ + public function getReason(): ?string + { + return $this->container['reason']; + } + + /** + * Sets reason + * + * @param string|null $reason The reason why the account cannot be synced + * + * @return $this + */ + public function setReason(?string $reason): static + { + if (is_null($reason)) { + throw new InvalidArgumentException('non-nullable reason cannot be null'); + } + $allowedValues = self::getReasonAllowableValues(); + if (!in_array($reason, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'reason', must be one of '%s'", + $reason, + implode("', '", $allowedValues) + ) + ); + } + $this->container['reason'] = $reason; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ClassDetailsLti.php b/src/Model/ClassDetailsLti.php new file mode 100644 index 0000000..d5c382e --- /dev/null +++ b/src/Model/ClassDetailsLti.php @@ -0,0 +1,487 @@ + + */ +class ClassDetailsLti implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ClassDetails_lti'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'context_id' => 'string', + 'context_title' => 'string', + 'context_label' => 'string', + 'has_nrps_service' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'context_id' => null, + 'context_title' => null, + 'context_label' => null, + 'has_nrps_service' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'context_id' => false, + 'context_title' => false, + 'context_label' => false, + 'has_nrps_service' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'context_id' => 'contextId', + 'context_title' => 'contextTitle', + 'context_label' => 'contextLabel', + 'has_nrps_service' => 'hasNrpsService' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'context_id' => 'setContextId', + 'context_title' => 'setContextTitle', + 'context_label' => 'setContextLabel', + 'has_nrps_service' => 'setHasNrpsService' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'context_id' => 'getContextId', + 'context_title' => 'getContextTitle', + 'context_label' => 'getContextLabel', + 'has_nrps_service' => 'getHasNrpsService' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('context_id', $data ?? [], null); + $this->setIfExists('context_title', $data ?? [], null); + $this->setIfExists('context_label', $data ?? [], null); + $this->setIfExists('has_nrps_service', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets context_id + * + * @return string|null + */ + public function getContextId(): ?string + { + return $this->container['context_id']; + } + + /** + * Sets context_id + * + * @param string|null $context_id Unique context identifier provided + * + * @return $this + */ + public function setContextId(?string $context_id): static + { + if (is_null($context_id)) { + throw new InvalidArgumentException('non-nullable context_id cannot be null'); + } + $this->container['context_id'] = $context_id; + + return $this; + } + + /** + * Gets context_title + * + * @return string|null + */ + public function getContextTitle(): ?string + { + return $this->container['context_title']; + } + + /** + * Sets context_title + * + * @param string|null $context_title Context title + * + * @return $this + */ + public function setContextTitle(?string $context_title): static + { + if (is_null($context_title)) { + throw new InvalidArgumentException('non-nullable context_title cannot be null'); + } + $this->container['context_title'] = $context_title; + + return $this; + } + + /** + * Gets context_label + * + * @return string|null + */ + public function getContextLabel(): ?string + { + return $this->container['context_label']; + } + + /** + * Sets context_label + * + * @param string|null $context_label Context label + * + * @return $this + */ + public function setContextLabel(?string $context_label): static + { + if (is_null($context_label)) { + throw new InvalidArgumentException('non-nullable context_label cannot be null'); + } + $this->container['context_label'] = $context_label; + + return $this; + } + + /** + * Gets has_nrps_service + * + * @return bool|null + */ + public function getHasNrpsService(): ?bool + { + return $this->container['has_nrps_service']; + } + + /** + * Sets has_nrps_service + * + * @param bool|null $has_nrps_service If true, the class has been synchronized with the LTI 1.3 NRPS 2.0 service + * + * @return $this + */ + public function setHasNrpsService(?bool $has_nrps_service): static + { + if (is_null($has_nrps_service)) { + throw new InvalidArgumentException('non-nullable has_nrps_service cannot be null'); + } + $this->container['has_nrps_service'] = $has_nrps_service; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ClassDetailsMfc.php b/src/Model/ClassDetailsMfc.php new file mode 100644 index 0000000..cb59c35 --- /dev/null +++ b/src/Model/ClassDetailsMfc.php @@ -0,0 +1,419 @@ + + */ +class ClassDetailsMfc implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ClassDetails_mfc'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'alternate_link' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'alternate_link' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'alternate_link' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'alternate_link' => 'alternateLink' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'alternate_link' => 'setAlternateLink' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'alternate_link' => 'getAlternateLink' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('alternate_link', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique identifier of the course on MusicFirst Classroom + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets alternate_link + * + * @return string|null + */ + public function getAlternateLink(): ?string + { + return $this->container['alternate_link']; + } + + /** + * Sets alternate_link + * + * @param string|null $alternate_link Link to MusicFirst Classroom class + * + * @return $this + */ + public function setAlternateLink(?string $alternate_link): static + { + if (is_null($alternate_link)) { + throw new InvalidArgumentException('non-nullable alternate_link cannot be null'); + } + $this->container['alternate_link'] = $alternate_link; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ClassDetailsMicrosoftGraph.php b/src/Model/ClassDetailsMicrosoftGraph.php new file mode 100644 index 0000000..52c5a84 --- /dev/null +++ b/src/Model/ClassDetailsMicrosoftGraph.php @@ -0,0 +1,384 @@ + + */ +class ClassDetailsMicrosoftGraph implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ClassDetails_microsoftGraph'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The course identifier on Microsoft Graph + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ClassGradeLevel.php b/src/Model/ClassGradeLevel.php new file mode 100644 index 0000000..89e5cc1 --- /dev/null +++ b/src/Model/ClassGradeLevel.php @@ -0,0 +1,52 @@ + + */ +class ClassUpdate implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ClassUpdate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'section' => 'string', + 'level' => '\Flat\APIClient\Model\ClassGradeLevel', + 'skills_focused' => 'string[]', + 'size' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'section' => null, + 'level' => null, + 'skills_focused' => null, + 'size' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'section' => false, + 'level' => false, + 'skills_focused' => false, + 'size' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'section' => 'section', + 'level' => 'level', + 'skills_focused' => 'skillsFocused', + 'size' => 'size' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'section' => 'setSection', + 'level' => 'setLevel', + 'skills_focused' => 'setSkillsFocused', + 'size' => 'setSize' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'section' => 'getSection', + 'level' => 'getLevel', + 'skills_focused' => 'getSkillsFocused', + 'size' => 'getSize' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const SKILLS_FOCUSED_NOTATION = 'notation'; + public const SKILLS_FOCUSED_SIGHT_READING = 'sight-reading'; + public const SKILLS_FOCUSED_PERFORMANCE_INSTRUMENTAL = 'performance-instrumental'; + public const SKILLS_FOCUSED_EAR_TRAINING = 'ear-training'; + public const SKILLS_FOCUSED_MUSIC_THEORY = 'music-theory'; + public const SKILLS_FOCUSED_COMPOSITION = 'composition'; + public const SKILLS_FOCUSED_JAZZ_ENSEMBLE = 'jazz-ensemble'; + public const SKILLS_FOCUSED_MUSIC_TECHNOLOGY = 'music-technology'; + public const SKILLS_FOCUSED_OTHER = 'other'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getSkillsFocusedAllowableValues() + { + return [ + self::SKILLS_FOCUSED_NOTATION, + self::SKILLS_FOCUSED_SIGHT_READING, + self::SKILLS_FOCUSED_PERFORMANCE_INSTRUMENTAL, + self::SKILLS_FOCUSED_EAR_TRAINING, + self::SKILLS_FOCUSED_MUSIC_THEORY, + self::SKILLS_FOCUSED_COMPOSITION, + self::SKILLS_FOCUSED_JAZZ_ENSEMBLE, + self::SKILLS_FOCUSED_MUSIC_TECHNOLOGY, + self::SKILLS_FOCUSED_OTHER, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('section', $data ?? [], null); + $this->setIfExists('level', $data ?? [], null); + $this->setIfExists('skills_focused', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['name']) && (mb_strlen($this->container['name']) > 255)) { + $invalidProperties[] = "invalid value for 'name', the character length must be smaller than or equal to 255."; + } + + if (!is_null($this->container['section']) && (mb_strlen($this->container['section']) > 255)) { + $invalidProperties[] = "invalid value for 'section', the character length must be smaller than or equal to 255."; + } + + if (!is_null($this->container['size']) && ($this->container['size'] < 0)) { + $invalidProperties[] = "invalid value for 'size', must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The name of the class + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + if ((mb_strlen($name) > 255)) { + throw new InvalidArgumentException('invalid length for $name when calling ClassUpdate., must be smaller than or equal to 255.'); + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets section + * + * @return string|null + */ + public function getSection(): ?string + { + return $this->container['section']; + } + + /** + * Sets section + * + * @param string|null $section The section of the class + * + * @return $this + */ + public function setSection(?string $section): static + { + if (is_null($section)) { + throw new InvalidArgumentException('non-nullable section cannot be null'); + } + if ((mb_strlen($section) > 255)) { + throw new InvalidArgumentException('invalid length for $section when calling ClassUpdate., must be smaller than or equal to 255.'); + } + + $this->container['section'] = $section; + + return $this; + } + + /** + * Gets level + * + * @return \Flat\APIClient\Model\ClassGradeLevel|null + */ + public function getLevel(): ?\Flat\APIClient\Model\ClassGradeLevel + { + return $this->container['level']; + } + + /** + * Sets level + * + * @param \Flat\APIClient\Model\ClassGradeLevel|null $level level + * + * @return $this + */ + public function setLevel(?\Flat\APIClient\Model\ClassGradeLevel $level): static + { + if (is_null($level)) { + throw new InvalidArgumentException('non-nullable level cannot be null'); + } + $this->container['level'] = $level; + + return $this; + } + + /** + * Gets skills_focused + * + * @return string[]|null + */ + public function getSkillsFocused(): ?array + { + return $this->container['skills_focused']; + } + + /** + * Sets skills_focused + * + * @param string[]|null $skills_focused Specific skills that will be focused in classroom + * + * @return $this + */ + public function setSkillsFocused(?array $skills_focused): static + { + if (is_null($skills_focused)) { + throw new InvalidArgumentException('non-nullable skills_focused cannot be null'); + } + $allowedValues = self::getSkillsFocusedAllowableValues(); + if (array_diff($skills_focused, $allowedValues)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value for 'skills_focused', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['skills_focused'] = $skills_focused; + + return $this; + } + + /** + * Gets size + * + * @return float|null + */ + public function getSize(): ?float + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param float|null $size Number of students in the classroom + * + * @return $this + */ + public function setSize(?float $size): static + { + if (is_null($size)) { + array_push($this->openAPINullablesSetToNull, 'size'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('size', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($size) && ($size < 0)) { + throw new InvalidArgumentException('invalid value for $size when calling ClassUpdate., must be bigger than or equal to 0.'); + } + + $this->container['size'] = $size; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/Collection.php b/src/Model/Collection.php new file mode 100644 index 0000000..8d8d8f6 --- /dev/null +++ b/src/Model/Collection.php @@ -0,0 +1,987 @@ + + */ +class Collection implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'Collection'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'title' => 'string', + 'html_url' => 'string', + 'type' => '\Flat\APIClient\Model\CollectionType', + 'label_key' => 'string', + 'privacy' => '\Flat\APIClient\Model\CollectionPrivacy', + 'sharing_key' => 'string', + 'app' => '\Flat\APIClient\Model\CollectionApp', + 'creation_date' => '\DateTime', + 'modification_date' => '\DateTime', + 'user' => '\Flat\APIClient\Model\UserPublicSummary', + 'organization' => 'string', + 'rights' => '\Flat\APIClient\Model\ResourceRights', + 'collaborators' => '\Flat\APIClient\Model\ResourceCollaborator[]', + 'is_pinned' => 'bool', + 'contents' => '\Flat\APIClient\Model\CollectionContents', + 'capabilities' => '\Flat\APIClient\Model\CollectionCapabilities', + 'collections' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'title' => null, + 'html_url' => 'url', + 'type' => null, + 'label_key' => null, + 'privacy' => null, + 'sharing_key' => null, + 'app' => null, + 'creation_date' => 'date-time', + 'modification_date' => 'date-time', + 'user' => null, + 'organization' => null, + 'rights' => null, + 'collaborators' => null, + 'is_pinned' => null, + 'contents' => null, + 'capabilities' => null, + 'collections' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'title' => false, + 'html_url' => false, + 'type' => false, + 'label_key' => false, + 'privacy' => false, + 'sharing_key' => false, + 'app' => false, + 'creation_date' => false, + 'modification_date' => false, + 'user' => false, + 'organization' => false, + 'rights' => false, + 'collaborators' => false, + 'is_pinned' => false, + 'contents' => false, + 'capabilities' => false, + 'collections' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'title' => 'title', + 'html_url' => 'htmlUrl', + 'type' => 'type', + 'label_key' => 'labelKey', + 'privacy' => 'privacy', + 'sharing_key' => 'sharingKey', + 'app' => 'app', + 'creation_date' => 'creationDate', + 'modification_date' => 'modificationDate', + 'user' => 'user', + 'organization' => 'organization', + 'rights' => 'rights', + 'collaborators' => 'collaborators', + 'is_pinned' => 'isPinned', + 'contents' => 'contents', + 'capabilities' => 'capabilities', + 'collections' => 'collections' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'title' => 'setTitle', + 'html_url' => 'setHtmlUrl', + 'type' => 'setType', + 'label_key' => 'setLabelKey', + 'privacy' => 'setPrivacy', + 'sharing_key' => 'setSharingKey', + 'app' => 'setApp', + 'creation_date' => 'setCreationDate', + 'modification_date' => 'setModificationDate', + 'user' => 'setUser', + 'organization' => 'setOrganization', + 'rights' => 'setRights', + 'collaborators' => 'setCollaborators', + 'is_pinned' => 'setIsPinned', + 'contents' => 'setContents', + 'capabilities' => 'setCapabilities', + 'collections' => 'setCollections' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'title' => 'getTitle', + 'html_url' => 'getHtmlUrl', + 'type' => 'getType', + 'label_key' => 'getLabelKey', + 'privacy' => 'getPrivacy', + 'sharing_key' => 'getSharingKey', + 'app' => 'getApp', + 'creation_date' => 'getCreationDate', + 'modification_date' => 'getModificationDate', + 'user' => 'getUser', + 'organization' => 'getOrganization', + 'rights' => 'getRights', + 'collaborators' => 'getCollaborators', + 'is_pinned' => 'getIsPinned', + 'contents' => 'getContents', + 'capabilities' => 'getCapabilities', + 'collections' => 'getCollections' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('html_url', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('label_key', $data ?? [], null); + $this->setIfExists('privacy', $data ?? [], null); + $this->setIfExists('sharing_key', $data ?? [], null); + $this->setIfExists('app', $data ?? [], null); + $this->setIfExists('creation_date', $data ?? [], null); + $this->setIfExists('modification_date', $data ?? [], null); + $this->setIfExists('user', $data ?? [], null); + $this->setIfExists('organization', $data ?? [], null); + $this->setIfExists('rights', $data ?? [], null); + $this->setIfExists('collaborators', $data ?? [], null); + $this->setIfExists('is_pinned', $data ?? [], null); + $this->setIfExists('contents', $data ?? [], null); + $this->setIfExists('capabilities', $data ?? [], null); + $this->setIfExists('collections', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['title'] === null) { + $invalidProperties[] = "'title' can't be null"; + } + if ($this->container['html_url'] === null) { + $invalidProperties[] = "'html_url' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['privacy'] === null) { + $invalidProperties[] = "'privacy' can't be null"; + } + if ($this->container['creation_date'] === null) { + $invalidProperties[] = "'creation_date' can't be null"; + } + if ($this->container['contents'] === null) { + $invalidProperties[] = "'contents' can't be null"; + } + if ($this->container['capabilities'] === null) { + $invalidProperties[] = "'capabilities' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Unique identifier of the collection + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets title + * + * @return string + */ + public function getTitle(): string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string $title The title of the collection + * + * @return $this + */ + public function setTitle(string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets html_url + * + * @return string + */ + public function getHtmlUrl(): string + { + return $this->container['html_url']; + } + + /** + * Sets html_url + * + * @param string $html_url The url where the collection can be viewed in a web browser + * + * @return $this + */ + public function setHtmlUrl(string $html_url): static + { + if (is_null($html_url)) { + throw new InvalidArgumentException('non-nullable html_url cannot be null'); + } + $this->container['html_url'] = $html_url; + + return $this; + } + + /** + * Gets type + * + * @return \Flat\APIClient\Model\CollectionType + */ + public function getType(): \Flat\APIClient\Model\CollectionType + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Flat\APIClient\Model\CollectionType $type type + * + * @return $this + */ + public function setType(\Flat\APIClient\Model\CollectionType $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets label_key + * + * @return string|null + */ + public function getLabelKey(): ?string + { + return $this->container['label_key']; + } + + /** + * Sets label_key + * + * @param string|null $label_key Product-specific translation key for the collection type. Only set for specific collection types: * For `regular` type: `playlist` (Flat) or `collection` (Flat for Education) * For `collaborations` type: `collaboration` (Flat) or `shared-scores` (Flat for Education) Not set for other collection types. + * + * @return $this + */ + public function setLabelKey(?string $label_key): static + { + if (is_null($label_key)) { + throw new InvalidArgumentException('non-nullable label_key cannot be null'); + } + $this->container['label_key'] = $label_key; + + return $this; + } + + /** + * Gets privacy + * + * @return \Flat\APIClient\Model\CollectionPrivacy + */ + public function getPrivacy(): \Flat\APIClient\Model\CollectionPrivacy + { + return $this->container['privacy']; + } + + /** + * Sets privacy + * + * @param \Flat\APIClient\Model\CollectionPrivacy $privacy privacy + * + * @return $this + */ + public function setPrivacy(\Flat\APIClient\Model\CollectionPrivacy $privacy): static + { + if (is_null($privacy)) { + throw new InvalidArgumentException('non-nullable privacy cannot be null'); + } + $this->container['privacy'] = $privacy; + + return $this; + } + + /** + * Gets sharing_key + * + * @return string|null + */ + public function getSharingKey(): ?string + { + return $this->container['sharing_key']; + } + + /** + * Sets sharing_key + * + * @param string|null $sharing_key The private sharing key of the collection (available when the `privacy` mode is set to `privateLink`) + * + * @return $this + */ + public function setSharingKey(?string $sharing_key): static + { + if (is_null($sharing_key)) { + throw new InvalidArgumentException('non-nullable sharing_key cannot be null'); + } + $this->container['sharing_key'] = $sharing_key; + + return $this; + } + + /** + * Gets app + * + * @return \Flat\APIClient\Model\CollectionApp|null + */ + public function getApp(): ?\Flat\APIClient\Model\CollectionApp + { + return $this->container['app']; + } + + /** + * Sets app + * + * @param \Flat\APIClient\Model\CollectionApp|null $app app + * + * @return $this + */ + public function setApp(?\Flat\APIClient\Model\CollectionApp $app): static + { + if (is_null($app)) { + throw new InvalidArgumentException('non-nullable app cannot be null'); + } + $this->container['app'] = $app; + + return $this; + } + + /** + * Gets creation_date + * + * @return \DateTime + */ + public function getCreationDate(): \DateTime + { + return $this->container['creation_date']; + } + + /** + * Sets creation_date + * + * @param \DateTime $creation_date The date when the collection was created + * + * @return $this + */ + public function setCreationDate(\DateTime $creation_date): static + { + if (is_null($creation_date)) { + throw new InvalidArgumentException('non-nullable creation_date cannot be null'); + } + $this->container['creation_date'] = $creation_date; + + return $this; + } + + /** + * Gets modification_date + * + * @return \DateTime|null + */ + public function getModificationDate(): ?\DateTime + { + return $this->container['modification_date']; + } + + /** + * Sets modification_date + * + * @param \DateTime|null $modification_date The date when the collection was last modified + * + * @return $this + */ + public function setModificationDate(?\DateTime $modification_date): static + { + if (is_null($modification_date)) { + throw new InvalidArgumentException('non-nullable modification_date cannot be null'); + } + $this->container['modification_date'] = $modification_date; + + return $this; + } + + /** + * Gets user + * + * @return \Flat\APIClient\Model\UserPublicSummary|null + */ + public function getUser(): ?\Flat\APIClient\Model\UserPublicSummary + { + return $this->container['user']; + } + + /** + * Sets user + * + * @param \Flat\APIClient\Model\UserPublicSummary|null $user user + * + * @return $this + */ + public function setUser(?\Flat\APIClient\Model\UserPublicSummary $user): static + { + if (is_null($user)) { + throw new InvalidArgumentException('non-nullable user cannot be null'); + } + $this->container['user'] = $user; + + return $this; + } + + /** + * Gets organization + * + * @return string|null + */ + public function getOrganization(): ?string + { + return $this->container['organization']; + } + + /** + * Sets organization + * + * @param string|null $organization If the score has been created in an organization, the identifier of this organization. + * + * @return $this + */ + public function setOrganization(?string $organization): static + { + if (is_null($organization)) { + throw new InvalidArgumentException('non-nullable organization cannot be null'); + } + $this->container['organization'] = $organization; + + return $this; + } + + /** + * Gets rights + * + * @return \Flat\APIClient\Model\ResourceRights|null + */ + public function getRights(): ?\Flat\APIClient\Model\ResourceRights + { + return $this->container['rights']; + } + + /** + * Sets rights + * + * @param \Flat\APIClient\Model\ResourceRights|null $rights rights + * + * @return $this + */ + public function setRights(?\Flat\APIClient\Model\ResourceRights $rights): static + { + if (is_null($rights)) { + throw new InvalidArgumentException('non-nullable rights cannot be null'); + } + $this->container['rights'] = $rights; + + return $this; + } + + /** + * Gets collaborators + * + * @return \Flat\APIClient\Model\ResourceCollaborator[]|null + */ + public function getCollaborators(): ?array + { + return $this->container['collaborators']; + } + + /** + * Sets collaborators + * + * @param \Flat\APIClient\Model\ResourceCollaborator[]|null $collaborators The list of the collaborators of the collection + * + * @return $this + */ + public function setCollaborators(?array $collaborators): static + { + if (is_null($collaborators)) { + throw new InvalidArgumentException('non-nullable collaborators cannot be null'); + } + $this->container['collaborators'] = $collaborators; + + return $this; + } + + /** + * Gets is_pinned + * + * @return bool|null + */ + public function getIsPinned(): ?bool + { + return $this->container['is_pinned']; + } + + /** + * Sets is_pinned + * + * @param bool|null $is_pinned Whether the collection is pinned by the owner + * + * @return $this + */ + public function setIsPinned(?bool $is_pinned): static + { + if (is_null($is_pinned)) { + throw new InvalidArgumentException('non-nullable is_pinned cannot be null'); + } + $this->container['is_pinned'] = $is_pinned; + + return $this; + } + + /** + * Gets contents + * + * @return \Flat\APIClient\Model\CollectionContents + */ + public function getContents(): \Flat\APIClient\Model\CollectionContents + { + return $this->container['contents']; + } + + /** + * Sets contents + * + * @param \Flat\APIClient\Model\CollectionContents $contents contents + * + * @return $this + */ + public function setContents(\Flat\APIClient\Model\CollectionContents $contents): static + { + if (is_null($contents)) { + throw new InvalidArgumentException('non-nullable contents cannot be null'); + } + $this->container['contents'] = $contents; + + return $this; + } + + /** + * Gets capabilities + * + * @return \Flat\APIClient\Model\CollectionCapabilities + */ + public function getCapabilities(): \Flat\APIClient\Model\CollectionCapabilities + { + return $this->container['capabilities']; + } + + /** + * Sets capabilities + * + * @param \Flat\APIClient\Model\CollectionCapabilities $capabilities capabilities + * + * @return $this + */ + public function setCapabilities(\Flat\APIClient\Model\CollectionCapabilities $capabilities): static + { + if (is_null($capabilities)) { + throw new InvalidArgumentException('non-nullable capabilities cannot be null'); + } + $this->container['capabilities'] = $capabilities; + + return $this; + } + + /** + * Gets collections + * + * @return string[]|null + */ + public function getCollections(): ?array + { + return $this->container['collections']; + } + + /** + * Sets collections + * + * @param string[]|null $collections The List of parent collections, which includes all the collections this score is included. Please note that you might not have access to all of them. + * + * @return $this + */ + public function setCollections(?array $collections): static + { + if (is_null($collections)) { + throw new InvalidArgumentException('non-nullable collections cannot be null'); + } + $this->container['collections'] = $collections; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CollectionApp.php b/src/Model/CollectionApp.php new file mode 100644 index 0000000..ca27f46 --- /dev/null +++ b/src/Model/CollectionApp.php @@ -0,0 +1,453 @@ + + */ +class CollectionApp implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'CollectionApp'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'logo' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'logo' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'logo' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'logo' => 'logo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'logo' => 'setLogo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'logo' => 'getLogo' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('logo', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The app unique identifier + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The name of the app + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets logo + * + * @return string|null + */ + public function getLogo(): ?string + { + return $this->container['logo']; + } + + /** + * Sets logo + * + * @param string|null $logo The app logo url + * + * @return $this + */ + public function setLogo(?string $logo): static + { + if (is_null($logo)) { + throw new InvalidArgumentException('non-nullable logo cannot be null'); + } + $this->container['logo'] = $logo; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CollectionCapabilities.php b/src/Model/CollectionCapabilities.php new file mode 100644 index 0000000..a433287 --- /dev/null +++ b/src/Model/CollectionCapabilities.php @@ -0,0 +1,536 @@ + + */ +class CollectionCapabilities implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'Collection_capabilities'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'can_edit' => 'bool', + 'can_share' => 'bool', + 'can_delete' => 'bool', + 'can_add_scores' => 'bool', + 'can_delete_scores' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'can_edit' => null, + 'can_share' => null, + 'can_delete' => null, + 'can_add_scores' => null, + 'can_delete_scores' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'can_edit' => false, + 'can_share' => false, + 'can_delete' => false, + 'can_add_scores' => false, + 'can_delete_scores' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'can_edit' => 'canEdit', + 'can_share' => 'canShare', + 'can_delete' => 'canDelete', + 'can_add_scores' => 'canAddScores', + 'can_delete_scores' => 'canDeleteScores' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'can_edit' => 'setCanEdit', + 'can_share' => 'setCanShare', + 'can_delete' => 'setCanDelete', + 'can_add_scores' => 'setCanAddScores', + 'can_delete_scores' => 'setCanDeleteScores' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'can_edit' => 'getCanEdit', + 'can_share' => 'getCanShare', + 'can_delete' => 'getCanDelete', + 'can_add_scores' => 'getCanAddScores', + 'can_delete_scores' => 'getCanDeleteScores' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('can_edit', $data ?? [], null); + $this->setIfExists('can_share', $data ?? [], null); + $this->setIfExists('can_delete', $data ?? [], null); + $this->setIfExists('can_add_scores', $data ?? [], null); + $this->setIfExists('can_delete_scores', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['can_edit'] === null) { + $invalidProperties[] = "'can_edit' can't be null"; + } + if ($this->container['can_share'] === null) { + $invalidProperties[] = "'can_share' can't be null"; + } + if ($this->container['can_delete'] === null) { + $invalidProperties[] = "'can_delete' can't be null"; + } + if ($this->container['can_add_scores'] === null) { + $invalidProperties[] = "'can_add_scores' can't be null"; + } + if ($this->container['can_delete_scores'] === null) { + $invalidProperties[] = "'can_delete_scores' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets can_edit + * + * @return bool + */ + public function getCanEdit(): bool + { + return $this->container['can_edit']; + } + + /** + * Sets can_edit + * + * @param bool $can_edit Whether the current user can modify the metadata for the collection + * + * @return $this + */ + public function setCanEdit(bool $can_edit): static + { + if (is_null($can_edit)) { + throw new InvalidArgumentException('non-nullable can_edit cannot be null'); + } + $this->container['can_edit'] = $can_edit; + + return $this; + } + + /** + * Gets can_share + * + * @return bool + */ + public function getCanShare(): bool + { + return $this->container['can_share']; + } + + /** + * Sets can_share + * + * @param bool $can_share Whether the current user can modify the sharing settings for the collection + * + * @return $this + */ + public function setCanShare(bool $can_share): static + { + if (is_null($can_share)) { + throw new InvalidArgumentException('non-nullable can_share cannot be null'); + } + $this->container['can_share'] = $can_share; + + return $this; + } + + /** + * Gets can_delete + * + * @return bool + */ + public function getCanDelete(): bool + { + return $this->container['can_delete']; + } + + /** + * Sets can_delete + * + * @param bool $can_delete Whether the current user can delete the collection + * + * @return $this + */ + public function setCanDelete(bool $can_delete): static + { + if (is_null($can_delete)) { + throw new InvalidArgumentException('non-nullable can_delete cannot be null'); + } + $this->container['can_delete'] = $can_delete; + + return $this; + } + + /** + * Gets can_add_scores + * + * @return bool + */ + public function getCanAddScores(): bool + { + return $this->container['can_add_scores']; + } + + /** + * Sets can_add_scores + * + * @param bool $can_add_scores Whether the current user can add scores to the collection If this collection has the `type` `trash`, this property will be set to `false`. Use `DELETE /v2/scores/{score}` to trash a score. + * + * @return $this + */ + public function setCanAddScores(bool $can_add_scores): static + { + if (is_null($can_add_scores)) { + throw new InvalidArgumentException('non-nullable can_add_scores cannot be null'); + } + $this->container['can_add_scores'] = $can_add_scores; + + return $this; + } + + /** + * Gets can_delete_scores + * + * @return bool + */ + public function getCanDeleteScores(): bool + { + return $this->container['can_delete_scores']; + } + + /** + * Sets can_delete_scores + * + * @param bool $can_delete_scores Whether the current user can delete scores from the collection If this collection has the `type` `trash`, this property will be set to `false`. Use `POST /v2/scores/{score}/untrash` to restore a score. + * + * @return $this + */ + public function setCanDeleteScores(bool $can_delete_scores): static + { + if (is_null($can_delete_scores)) { + throw new InvalidArgumentException('non-nullable can_delete_scores cannot be null'); + } + $this->container['can_delete_scores'] = $can_delete_scores; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CollectionContents.php b/src/Model/CollectionContents.php new file mode 100644 index 0000000..a53a912 --- /dev/null +++ b/src/Model/CollectionContents.php @@ -0,0 +1,388 @@ + + */ +class CollectionContents implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'Collection_contents'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'scores_count' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'scores_count' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'scores_count' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'scores_count' => 'scoresCount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'scores_count' => 'setScoresCount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'scores_count' => 'getScoresCount' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('scores_count', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['scores_count'] === null) { + $invalidProperties[] = "'scores_count' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets scores_count + * + * @return int + */ + public function getScoresCount(): int + { + return $this->container['scores_count']; + } + + /** + * Sets scores_count + * + * @param int $scores_count The number of scores in the collection + * + * @return $this + */ + public function setScoresCount(int $scores_count): static + { + if (is_null($scores_count)) { + throw new InvalidArgumentException('non-nullable scores_count cannot be null'); + } + $this->container['scores_count'] = $scores_count; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CollectionCreation.php b/src/Model/CollectionCreation.php new file mode 100644 index 0000000..6606a07 --- /dev/null +++ b/src/Model/CollectionCreation.php @@ -0,0 +1,433 @@ + + */ +class CollectionCreation implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'CollectionCreation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'title' => 'string', + 'privacy' => '\Flat\APIClient\Model\CollectionPrivacy' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'title' => null, + 'privacy' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'title' => false, + 'privacy' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'title' => 'title', + 'privacy' => 'privacy' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'title' => 'setTitle', + 'privacy' => 'setPrivacy' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'title' => 'getTitle', + 'privacy' => 'getPrivacy' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('privacy', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['title']) && (mb_strlen($this->container['title']) > 300)) { + $invalidProperties[] = "invalid value for 'title', the character length must be smaller than or equal to 300."; + } + + if (!is_null($this->container['title']) && (mb_strlen($this->container['title']) < 1)) { + $invalidProperties[] = "invalid value for 'title', the character length must be bigger than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets title + * + * @return string|null + */ + public function getTitle(): ?string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the collection + * + * @return $this + */ + public function setTitle(?string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + if ((mb_strlen($title) > 300)) { + throw new InvalidArgumentException('invalid length for $title when calling CollectionCreation., must be smaller than or equal to 300.'); + } + if ((mb_strlen($title) < 1)) { + throw new InvalidArgumentException('invalid length for $title when calling CollectionCreation., must be bigger than or equal to 1.'); + } + + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets privacy + * + * @return \Flat\APIClient\Model\CollectionPrivacy|null + */ + public function getPrivacy(): ?\Flat\APIClient\Model\CollectionPrivacy + { + return $this->container['privacy']; + } + + /** + * Sets privacy + * + * @param \Flat\APIClient\Model\CollectionPrivacy|null $privacy privacy + * + * @return $this + */ + public function setPrivacy(?\Flat\APIClient\Model\CollectionPrivacy $privacy): static + { + if (is_null($privacy)) { + throw new InvalidArgumentException('non-nullable privacy cannot be null'); + } + $this->container['privacy'] = $privacy; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CollectionModification.php b/src/Model/CollectionModification.php new file mode 100644 index 0000000..57dd722 --- /dev/null +++ b/src/Model/CollectionModification.php @@ -0,0 +1,434 @@ + + */ +class CollectionModification implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'CollectionModification'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'title' => 'string', + 'privacy' => '\Flat\APIClient\Model\CollectionPrivacy' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'title' => null, + 'privacy' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'title' => false, + 'privacy' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'title' => 'title', + 'privacy' => 'privacy' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'title' => 'setTitle', + 'privacy' => 'setPrivacy' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'title' => 'getTitle', + 'privacy' => 'getPrivacy' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('privacy', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['title']) && (mb_strlen($this->container['title']) > 300)) { + $invalidProperties[] = "invalid value for 'title', the character length must be smaller than or equal to 300."; + } + + if (!is_null($this->container['title']) && (mb_strlen($this->container['title']) < 1)) { + $invalidProperties[] = "invalid value for 'title', the character length must be bigger than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets title + * + * @return string|null + */ + public function getTitle(): ?string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the collection + * + * @return $this + */ + public function setTitle(?string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + if ((mb_strlen($title) > 300)) { + throw new InvalidArgumentException('invalid length for $title when calling CollectionModification., must be smaller than or equal to 300.'); + } + if ((mb_strlen($title) < 1)) { + throw new InvalidArgumentException('invalid length for $title when calling CollectionModification., must be bigger than or equal to 1.'); + } + + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets privacy + * + * @return \Flat\APIClient\Model\CollectionPrivacy|null + */ + public function getPrivacy(): ?\Flat\APIClient\Model\CollectionPrivacy + { + return $this->container['privacy']; + } + + /** + * Sets privacy + * + * @param \Flat\APIClient\Model\CollectionPrivacy|null $privacy privacy + * + * @return $this + */ + public function setPrivacy(?\Flat\APIClient\Model\CollectionPrivacy $privacy): static + { + if (is_null($privacy)) { + throw new InvalidArgumentException('non-nullable privacy cannot be null'); + } + $this->container['privacy'] = $privacy; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CollectionPrivacy.php b/src/Model/CollectionPrivacy.php new file mode 100644 index 0000000..40a9dc8 --- /dev/null +++ b/src/Model/CollectionPrivacy.php @@ -0,0 +1,44 @@ + + */ +class CreditTransaction implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'CreditTransaction'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'type' => 'string', + 'feature' => 'string', + 'amount' => 'int', + 'source' => 'string', + 'state' => 'string', + 'job' => 'string', + 'creation_date' => '\DateTime', + 'modification_date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'type' => null, + 'feature' => null, + 'amount' => null, + 'source' => null, + 'state' => null, + 'job' => null, + 'creation_date' => 'date-time', + 'modification_date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'type' => false, + 'feature' => false, + 'amount' => false, + 'source' => false, + 'state' => false, + 'job' => false, + 'creation_date' => false, + 'modification_date' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'type' => 'type', + 'feature' => 'feature', + 'amount' => 'amount', + 'source' => 'source', + 'state' => 'state', + 'job' => 'job', + 'creation_date' => 'creationDate', + 'modification_date' => 'modificationDate' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'type' => 'setType', + 'feature' => 'setFeature', + 'amount' => 'setAmount', + 'source' => 'setSource', + 'state' => 'setState', + 'job' => 'setJob', + 'creation_date' => 'setCreationDate', + 'modification_date' => 'setModificationDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'type' => 'getType', + 'feature' => 'getFeature', + 'amount' => 'getAmount', + 'source' => 'getSource', + 'state' => 'getState', + 'job' => 'getJob', + 'creation_date' => 'getCreationDate', + 'modification_date' => 'getModificationDate' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const TYPE_AI = 'ai'; + public const FEATURE_OMR = 'omr'; + public const SOURCE_SUBSCRIPTION = 'subscription'; + public const SOURCE_PURCHASE = 'purchase'; + public const SOURCE_FREE_TIER = 'free_tier'; + public const SOURCE_SUPPORT = 'support'; + public const STATE_ACTIVE = 'active'; + public const STATE_CANCELED = 'canceled'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getTypeAllowableValues() + { + return [ + self::TYPE_AI, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getFeatureAllowableValues() + { + return [ + self::FEATURE_OMR, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getSourceAllowableValues() + { + return [ + self::SOURCE_SUBSCRIPTION, + self::SOURCE_PURCHASE, + self::SOURCE_FREE_TIER, + self::SOURCE_SUPPORT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getStateAllowableValues() + { + return [ + self::STATE_ACTIVE, + self::STATE_CANCELED, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('feature', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('job', $data ?? [], null); + $this->setIfExists('creation_date', $data ?? [], null); + $this->setIfExists('modification_date', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + $allowedValues = self::getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = self::getFeatureAllowableValues(); + if (!is_null($this->container['feature']) && !in_array($this->container['feature'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'feature', must be one of '%s'", + $this->container['feature'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['amount'] === null) { + $invalidProperties[] = "'amount' can't be null"; + } + if ($this->container['source'] === null) { + $invalidProperties[] = "'source' can't be null"; + } + $allowedValues = self::getSourceAllowableValues(); + if (!is_null($this->container['source']) && !in_array($this->container['source'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'source', must be one of '%s'", + $this->container['source'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['state'] === null) { + $invalidProperties[] = "'state' can't be null"; + } + $allowedValues = self::getStateAllowableValues(); + if (!is_null($this->container['state']) && !in_array($this->container['state'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'state', must be one of '%s'", + $this->container['state'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['creation_date'] === null) { + $invalidProperties[] = "'creation_date' can't be null"; + } + if ($this->container['modification_date'] === null) { + $invalidProperties[] = "'modification_date' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Unique identifier of the credit transaction + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string + */ + public function getType(): string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type Credit category. `ai` covers every AI-powered feature. + * + * @return $this + */ + public function setType(string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = self::getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets feature + * + * @return string|null + */ + public function getFeature(): ?string + { + return $this->container['feature']; + } + + /** + * Sets feature + * + * @param string|null $feature Which product the credits relate to. Set on deductions and on the credits a refund returns, absent on credit-pack top-ups, which are not tied to a single feature. + * + * @return $this + */ + public function setFeature(?string $feature): static + { + if (is_null($feature)) { + throw new InvalidArgumentException('non-nullable feature cannot be null'); + } + $allowedValues = self::getFeatureAllowableValues(); + if (!in_array($feature, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'feature', must be one of '%s'", + $feature, + implode("', '", $allowedValues) + ) + ); + } + $this->container['feature'] = $feature; + + return $this; + } + + /** + * Gets amount + * + * @return int + */ + public function getAmount(): int + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int $amount How many credits this entry moved, signed: positive for top-ups (`+30` from a credit pack), negative for deductions (`-2` for a two-page import). Sum only entries whose `state` is `active`. + * + * @return $this + */ + public function setAmount(int $amount): static + { + if (is_null($amount)) { + throw new InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets source + * + * @return string + */ + public function getSource(): string + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param string $source Which pool the credits came from: * `subscription`: the plan's periodic allowance * `purchase`: credits bought as a pack, which do not expire with the billing period * `free_tier`: promotional grants * `support`: a manual adjustment made by Flat's support team A single import can produce two entries when it spans two pools: the plan allowance is drawn down first, and the remainder comes from `purchase`. + * + * @return $this + */ + public function setSource(string $source): static + { + if (is_null($source)) { + throw new InvalidArgumentException('non-nullable source cannot be null'); + } + $allowedValues = self::getSourceAllowableValues(); + if (!in_array($source, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'source', must be one of '%s'", + $source, + implode("', '", $allowedValues) + ) + ); + } + $this->container['source'] = $source; + + return $this; + } + + /** + * Gets state + * + * @return string + */ + public function getState(): string + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string $state Whether the entry still counts: * `active`: in effect * `canceled`: reversed, and no longer affecting the balance. Deductions are canceled when the import they paid for fails or is refunded. + * + * @return $this + */ + public function setState(string $state): static + { + if (is_null($state)) { + throw new InvalidArgumentException('non-nullable state cannot be null'); + } + $allowedValues = self::getStateAllowableValues(); + if (!in_array($state, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'state', must be one of '%s'", + $state, + implode("', '", $allowedValues) + ) + ); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets job + * + * @return string|null + */ + public function getJob(): ?string + { + return $this->container['job']; + } + + /** + * Sets job + * + * @param string|null $job Identifier of the import this entry belongs to, when it relates to one. Present on an import's deduction, on its reversal, and on credits returned when an import is refunded. Absent on credit-pack top-ups and manual adjustments. + * + * @return $this + */ + public function setJob(?string $job): static + { + if (is_null($job)) { + throw new InvalidArgumentException('non-nullable job cannot be null'); + } + $this->container['job'] = $job; + + return $this; + } + + /** + * Gets creation_date + * + * @return \DateTime + */ + public function getCreationDate(): \DateTime + { + return $this->container['creation_date']; + } + + /** + * Sets creation_date + * + * @param \DateTime $creation_date When the transaction was created + * + * @return $this + */ + public function setCreationDate(\DateTime $creation_date): static + { + if (is_null($creation_date)) { + throw new InvalidArgumentException('non-nullable creation_date cannot be null'); + } + $this->container['creation_date'] = $creation_date; + + return $this; + } + + /** + * Gets modification_date + * + * @return \DateTime + */ + public function getModificationDate(): \DateTime + { + return $this->container['modification_date']; + } + + /** + * Sets modification_date + * + * @param \DateTime $modification_date When the transaction was last modified + * + * @return $this + */ + public function setModificationDate(\DateTime $modification_date): static + { + if (is_null($modification_date)) { + throw new InvalidArgumentException('non-nullable modification_date cannot be null'); + } + $this->container['modification_date'] = $modification_date; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/EduLibrary.php b/src/Model/EduLibrary.php new file mode 100644 index 0000000..12c7550 --- /dev/null +++ b/src/Model/EduLibrary.php @@ -0,0 +1,571 @@ + + */ +class EduLibrary implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'EduLibrary'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'type' => 'string', + 'visibility' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'type' => null, + 'visibility' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'type' => false, + 'visibility' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'type' => 'type', + 'visibility' => 'visibility' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'type' => 'setType', + 'visibility' => 'setVisibility' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'type' => 'getType', + 'visibility' => 'getVisibility' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const TYPE_MY_RESOURCES = 'myResources'; + public const TYPE_ORGANIZATION_RESOURCES = 'organizationResources'; + public const TYPE_FLAT_EDU_CONTENT = 'flatEduContent'; + public const VISIBILITY__PRIVATE = 'private'; + public const VISIBILITY_ORGANIZATION = 'organization'; + public const VISIBILITY__PUBLIC = 'public'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getTypeAllowableValues() + { + return [ + self::TYPE_MY_RESOURCES, + self::TYPE_ORGANIZATION_RESOURCES, + self::TYPE_FLAT_EDU_CONTENT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getVisibilityAllowableValues() + { + return [ + self::VISIBILITY__PRIVATE, + self::VISIBILITY_ORGANIZATION, + self::VISIBILITY__PUBLIC, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('visibility', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + $allowedValues = self::getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['visibility'] === null) { + $invalidProperties[] = "'visibility' can't be null"; + } + $allowedValues = self::getVisibilityAllowableValues(); + if (!is_null($this->container['visibility']) && !in_array($this->container['visibility'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'visibility', must be one of '%s'", + $this->container['visibility'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Unique identifier of the library. This one can be used to list the underlying resources using `GET /v2/eduResources?parent={library-id}` + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName(): string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Name of the lirbary + * + * @return $this + */ + public function setName(string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets type + * + * @return string + */ + public function getType(): string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type Type of the library + * + * @return $this + */ + public function setType(string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = self::getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets visibility + * + * @return string + */ + public function getVisibility(): string + { + return $this->container['visibility']; + } + + /** + * Sets visibility + * + * @param string $visibility Visibility of the library + * + * @return $this + */ + public function setVisibility(string $visibility): static + { + if (is_null($visibility)) { + throw new InvalidArgumentException('non-nullable visibility cannot be null'); + } + $allowedValues = self::getVisibilityAllowableValues(); + if (!in_array($visibility, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'visibility', must be one of '%s'", + $visibility, + implode("', '", $allowedValues) + ) + ); + } + $this->container['visibility'] = $visibility; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/EduResource.php b/src/Model/EduResource.php new file mode 100644 index 0000000..806dbfb --- /dev/null +++ b/src/Model/EduResource.php @@ -0,0 +1,873 @@ + + */ +class EduResource implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'EduResource'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'creator' => 'string', + 'type' => '\Flat\APIClient\Model\EduResourceType', + 'privacy' => '\Flat\APIClient\Model\EduResourcePrivacy', + 'tags' => 'string[]', + 'parent' => 'string', + 'title' => 'string', + 'sharing_description' => 'string', + 'sharing_description_html' => 'string', + 'creation_date' => '\DateTime', + 'update_date' => '\DateTime', + 'resource' => '\Flat\APIClient\Model\EduResourceResource', + 'capabilities' => '\Flat\APIClient\Model\EduResourceCapabilities', + 'subjects' => '\Flat\APIClient\Model\TeachingTheme[]', + 'grades' => '\Flat\APIClient\Model\Grade[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'creator' => null, + 'type' => null, + 'privacy' => null, + 'tags' => null, + 'parent' => null, + 'title' => null, + 'sharing_description' => null, + 'sharing_description_html' => null, + 'creation_date' => 'date-time', + 'update_date' => 'date-time', + 'resource' => null, + 'capabilities' => null, + 'subjects' => null, + 'grades' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'creator' => false, + 'type' => false, + 'privacy' => false, + 'tags' => false, + 'parent' => false, + 'title' => false, + 'sharing_description' => false, + 'sharing_description_html' => false, + 'creation_date' => false, + 'update_date' => false, + 'resource' => false, + 'capabilities' => false, + 'subjects' => false, + 'grades' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'creator' => 'creator', + 'type' => 'type', + 'privacy' => 'privacy', + 'tags' => 'tags', + 'parent' => 'parent', + 'title' => 'title', + 'sharing_description' => 'sharingDescription', + 'sharing_description_html' => 'sharingDescriptionHtml', + 'creation_date' => 'creationDate', + 'update_date' => 'updateDate', + 'resource' => 'resource', + 'capabilities' => 'capabilities', + 'subjects' => 'subjects', + 'grades' => 'grades' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'creator' => 'setCreator', + 'type' => 'setType', + 'privacy' => 'setPrivacy', + 'tags' => 'setTags', + 'parent' => 'setParent', + 'title' => 'setTitle', + 'sharing_description' => 'setSharingDescription', + 'sharing_description_html' => 'setSharingDescriptionHtml', + 'creation_date' => 'setCreationDate', + 'update_date' => 'setUpdateDate', + 'resource' => 'setResource', + 'capabilities' => 'setCapabilities', + 'subjects' => 'setSubjects', + 'grades' => 'setGrades' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'creator' => 'getCreator', + 'type' => 'getType', + 'privacy' => 'getPrivacy', + 'tags' => 'getTags', + 'parent' => 'getParent', + 'title' => 'getTitle', + 'sharing_description' => 'getSharingDescription', + 'sharing_description_html' => 'getSharingDescriptionHtml', + 'creation_date' => 'getCreationDate', + 'update_date' => 'getUpdateDate', + 'resource' => 'getResource', + 'capabilities' => 'getCapabilities', + 'subjects' => 'getSubjects', + 'grades' => 'getGrades' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('creator', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('privacy', $data ?? [], null); + $this->setIfExists('tags', $data ?? [], null); + $this->setIfExists('parent', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('sharing_description', $data ?? [], null); + $this->setIfExists('sharing_description_html', $data ?? [], null); + $this->setIfExists('creation_date', $data ?? [], null); + $this->setIfExists('update_date', $data ?? [], null); + $this->setIfExists('resource', $data ?? [], null); + $this->setIfExists('capabilities', $data ?? [], null); + $this->setIfExists('subjects', $data ?? [], null); + $this->setIfExists('grades', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['title'] === null) { + $invalidProperties[] = "'title' can't be null"; + } + if ($this->container['capabilities'] === null) { + $invalidProperties[] = "'capabilities' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Resource unique identifier + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets creator + * + * @return string|null + */ + public function getCreator(): ?string + { + return $this->container['creator']; + } + + /** + * Sets creator + * + * @param string|null $creator The User identifier of the resource creator + * + * @return $this + */ + public function setCreator(?string $creator): static + { + if (is_null($creator)) { + throw new InvalidArgumentException('non-nullable creator cannot be null'); + } + $this->container['creator'] = $creator; + + return $this; + } + + /** + * Gets type + * + * @return \Flat\APIClient\Model\EduResourceType + */ + public function getType(): \Flat\APIClient\Model\EduResourceType + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Flat\APIClient\Model\EduResourceType $type type + * + * @return $this + */ + public function setType(\Flat\APIClient\Model\EduResourceType $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets privacy + * + * @return \Flat\APIClient\Model\EduResourcePrivacy|null + */ + public function getPrivacy(): ?\Flat\APIClient\Model\EduResourcePrivacy + { + return $this->container['privacy']; + } + + /** + * Sets privacy + * + * @param \Flat\APIClient\Model\EduResourcePrivacy|null $privacy privacy + * + * @return $this + */ + public function setPrivacy(?\Flat\APIClient\Model\EduResourcePrivacy $privacy): static + { + if (is_null($privacy)) { + throw new InvalidArgumentException('non-nullable privacy cannot be null'); + } + $this->container['privacy'] = $privacy; + + return $this; + } + + /** + * Gets tags + * + * @return string[]|null + */ + public function getTags(): ?array + { + return $this->container['tags']; + } + + /** + * Sets tags + * + * @param string[]|null $tags Specific attributes for the resource (e.g. sample resources with custom design) + * + * @return $this + */ + public function setTags(?array $tags): static + { + if (is_null($tags)) { + throw new InvalidArgumentException('non-nullable tags cannot be null'); + } + $this->container['tags'] = $tags; + + return $this; + } + + /** + * Gets parent + * + * @return string|null + */ + public function getParent(): ?string + { + return $this->container['parent']; + } + + /** + * Sets parent + * + * @param string|null $parent Identifier of the parent resource, e.g. a folder or root + * + * @return $this + */ + public function setParent(?string $parent): static + { + if (is_null($parent)) { + throw new InvalidArgumentException('non-nullable parent cannot be null'); + } + $this->container['parent'] = $parent; + + return $this; + } + + /** + * Gets title + * + * @return string + */ + public function getTitle(): string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string $title Title of the resource + * + * @return $this + */ + public function setTitle(string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets sharing_description + * + * @return string|null + */ + public function getSharingDescription(): ?string + { + return $this->container['sharing_description']; + } + + /** + * Sets sharing_description + * + * @param string|null $sharing_description Sharing description of this resource + * + * @return $this + */ + public function setSharingDescription(?string $sharing_description): static + { + if (is_null($sharing_description)) { + throw new InvalidArgumentException('non-nullable sharing_description cannot be null'); + } + $this->container['sharing_description'] = $sharing_description; + + return $this; + } + + /** + * Gets sharing_description_html + * + * @return string|null + */ + public function getSharingDescriptionHtml(): ?string + { + return $this->container['sharing_description_html']; + } + + /** + * Sets sharing_description_html + * + * @param string|null $sharing_description_html HTML version of sharing description with rich text formatting. Supports safe HTML tags: p, br, strong, b, em, i, u, a. + * + * @return $this + */ + public function setSharingDescriptionHtml(?string $sharing_description_html): static + { + if (is_null($sharing_description_html)) { + throw new InvalidArgumentException('non-nullable sharing_description_html cannot be null'); + } + $this->container['sharing_description_html'] = $sharing_description_html; + + return $this; + } + + /** + * Gets creation_date + * + * @return \DateTime|null + */ + public function getCreationDate(): ?\DateTime + { + return $this->container['creation_date']; + } + + /** + * Sets creation_date + * + * @param \DateTime|null $creation_date The date when the resource was created + * + * @return $this + */ + public function setCreationDate(?\DateTime $creation_date): static + { + if (is_null($creation_date)) { + throw new InvalidArgumentException('non-nullable creation_date cannot be null'); + } + $this->container['creation_date'] = $creation_date; + + return $this; + } + + /** + * Gets update_date + * + * @return \DateTime|null + */ + public function getUpdateDate(): ?\DateTime + { + return $this->container['update_date']; + } + + /** + * Sets update_date + * + * @param \DateTime|null $update_date The date when the resource was updated + * + * @return $this + */ + public function setUpdateDate(?\DateTime $update_date): static + { + if (is_null($update_date)) { + throw new InvalidArgumentException('non-nullable update_date cannot be null'); + } + $this->container['update_date'] = $update_date; + + return $this; + } + + /** + * Gets resource + * + * @return \Flat\APIClient\Model\Assignment|\Flat\APIClient\Model\EduResourceFolder|null + */ + public function getResource(): \Flat\APIClient\Model\Assignment|\Flat\APIClient\Model\EduResourceFolder|null + { + return $this->container['resource']; + } + + /** + * Sets resource + * + * @param \Flat\APIClient\Model\Assignment|\Flat\APIClient\Model\EduResourceFolder|null $resource resource + * + * @return $this + */ + public function setResource(\Flat\APIClient\Model\Assignment|\Flat\APIClient\Model\EduResourceFolder|null $resource): static + { + if (is_null($resource)) { + throw new InvalidArgumentException('non-nullable resource cannot be null'); + } + $this->container['resource'] = $resource; + + return $this; + } + + /** + * Gets capabilities + * + * @return \Flat\APIClient\Model\EduResourceCapabilities + */ + public function getCapabilities(): \Flat\APIClient\Model\EduResourceCapabilities + { + return $this->container['capabilities']; + } + + /** + * Sets capabilities + * + * @param \Flat\APIClient\Model\EduResourceCapabilities $capabilities capabilities + * + * @return $this + */ + public function setCapabilities(\Flat\APIClient\Model\EduResourceCapabilities $capabilities): static + { + if (is_null($capabilities)) { + throw new InvalidArgumentException('non-nullable capabilities cannot be null'); + } + $this->container['capabilities'] = $capabilities; + + return $this; + } + + /** + * Gets subjects + * + * @return \Flat\APIClient\Model\TeachingTheme[]|null + */ + public function getSubjects(): ?array + { + return $this->container['subjects']; + } + + /** + * Sets subjects + * + * @param \Flat\APIClient\Model\TeachingTheme[]|null $subjects The subjects of this resource, or the subjects of the resources included in the folder + * + * @return $this + */ + public function setSubjects(?array $subjects): static + { + if (is_null($subjects)) { + throw new InvalidArgumentException('non-nullable subjects cannot be null'); + } + $this->container['subjects'] = $subjects; + + return $this; + } + + /** + * Gets grades + * + * @return \Flat\APIClient\Model\Grade[]|null + */ + public function getGrades(): ?array + { + return $this->container['grades']; + } + + /** + * Sets grades + * + * @param \Flat\APIClient\Model\Grade[]|null $grades The grades of this resource, or the grades of the resources included in the folder. + * + * @return $this + */ + public function setGrades(?array $grades): static + { + if (is_null($grades)) { + throw new InvalidArgumentException('non-nullable grades cannot be null'); + } + $this->container['grades'] = $grades; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/EduResourceAssignmentCreation.php b/src/Model/EduResourceAssignmentCreation.php new file mode 100644 index 0000000..0e3fe8f --- /dev/null +++ b/src/Model/EduResourceAssignmentCreation.php @@ -0,0 +1,385 @@ + + */ +class EduResourceAssignmentCreation implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'EduResourceAssignmentCreation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => '\Flat\APIClient\Model\AssignmentType' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return \Flat\APIClient\Model\AssignmentType|null + */ + public function getType(): ?\Flat\APIClient\Model\AssignmentType + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Flat\APIClient\Model\AssignmentType|null $type type + * + * @return $this + */ + public function setType(?\Flat\APIClient\Model\AssignmentType $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/EduResourceCapabilities.php b/src/Model/EduResourceCapabilities.php new file mode 100644 index 0000000..c83b1bb --- /dev/null +++ b/src/Model/EduResourceCapabilities.php @@ -0,0 +1,487 @@ + + */ +class EduResourceCapabilities implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'EduResource_capabilities'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'can_edit' => 'bool', + 'can_add_resources' => 'bool', + 'can_add_folders' => 'bool', + 'can_change_privacy' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'can_edit' => null, + 'can_add_resources' => null, + 'can_add_folders' => null, + 'can_change_privacy' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'can_edit' => false, + 'can_add_resources' => false, + 'can_add_folders' => false, + 'can_change_privacy' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'can_edit' => 'canEdit', + 'can_add_resources' => 'canAddResources', + 'can_add_folders' => 'canAddFolders', + 'can_change_privacy' => 'canChangePrivacy' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'can_edit' => 'setCanEdit', + 'can_add_resources' => 'setCanAddResources', + 'can_add_folders' => 'setCanAddFolders', + 'can_change_privacy' => 'setCanChangePrivacy' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'can_edit' => 'getCanEdit', + 'can_add_resources' => 'getCanAddResources', + 'can_add_folders' => 'getCanAddFolders', + 'can_change_privacy' => 'getCanChangePrivacy' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('can_edit', $data ?? [], null); + $this->setIfExists('can_add_resources', $data ?? [], null); + $this->setIfExists('can_add_folders', $data ?? [], null); + $this->setIfExists('can_change_privacy', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets can_edit + * + * @return bool|null + */ + public function getCanEdit(): ?bool + { + return $this->container['can_edit']; + } + + /** + * Sets can_edit + * + * @param bool|null $can_edit Whether the current user can modify this resource + * + * @return $this + */ + public function setCanEdit(?bool $can_edit): static + { + if (is_null($can_edit)) { + throw new InvalidArgumentException('non-nullable can_edit cannot be null'); + } + $this->container['can_edit'] = $can_edit; + + return $this; + } + + /** + * Gets can_add_resources + * + * @return bool|null + */ + public function getCanAddResources(): ?bool + { + return $this->container['can_add_resources']; + } + + /** + * Sets can_add_resources + * + * @param bool|null $can_add_resources Whether the current user can add resources within this resource (e.g. `assignment` inside a `folder`) + * + * @return $this + */ + public function setCanAddResources(?bool $can_add_resources): static + { + if (is_null($can_add_resources)) { + throw new InvalidArgumentException('non-nullable can_add_resources cannot be null'); + } + $this->container['can_add_resources'] = $can_add_resources; + + return $this; + } + + /** + * Gets can_add_folders + * + * @return bool|null + */ + public function getCanAddFolders(): ?bool + { + return $this->container['can_add_folders']; + } + + /** + * Sets can_add_folders + * + * @param bool|null $can_add_folders Whether the current user can add folders within this resource (e.g. `folder` inside `root`) + * + * @return $this + */ + public function setCanAddFolders(?bool $can_add_folders): static + { + if (is_null($can_add_folders)) { + throw new InvalidArgumentException('non-nullable can_add_folders cannot be null'); + } + $this->container['can_add_folders'] = $can_add_folders; + + return $this; + } + + /** + * Gets can_change_privacy + * + * @return bool|null + */ + public function getCanChangePrivacy(): ?bool + { + return $this->container['can_change_privacy']; + } + + /** + * Sets can_change_privacy + * + * @param bool|null $can_change_privacy Whether the current user can change the privacy of this resource (e.g. to share as `organizationPublic` or unshare it with `private`) + * + * @return $this + */ + public function setCanChangePrivacy(?bool $can_change_privacy): static + { + if (is_null($can_change_privacy)) { + throw new InvalidArgumentException('non-nullable can_change_privacy cannot be null'); + } + $this->container['can_change_privacy'] = $can_change_privacy; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/EduResourceCopy.php b/src/Model/EduResourceCopy.php new file mode 100644 index 0000000..419f39a --- /dev/null +++ b/src/Model/EduResourceCopy.php @@ -0,0 +1,388 @@ + + */ +class EduResourceCopy implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'EduResourceCopy'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'destination' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'destination' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'destination' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'destination' => 'destination' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'destination' => 'setDestination' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'destination' => 'getDestination' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('destination', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['destination'] === null) { + $invalidProperties[] = "'destination' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets destination + * + * @return string + */ + public function getDestination(): string + { + return $this->container['destination']; + } + + /** + * Sets destination + * + * @param string $destination Unique identifier of the destination of the folder where to copy this resource. This can also be `root` to copy the resource at the root of the user resource library. + * + * @return $this + */ + public function setDestination(string $destination): static + { + if (is_null($destination)) { + throw new InvalidArgumentException('non-nullable destination cannot be null'); + } + $this->container['destination'] = $destination; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/EduResourceCreation.php b/src/Model/EduResourceCreation.php new file mode 100644 index 0000000..42d633e --- /dev/null +++ b/src/Model/EduResourceCreation.php @@ -0,0 +1,592 @@ + + */ +class EduResourceCreation implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'EduResourceCreation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => '\Flat\APIClient\Model\EduResourceType', + 'title' => 'string', + 'parent' => 'string', + 'sharing_description' => 'string', + 'sharing_description_html' => 'string', + 'resource' => '\Flat\APIClient\Model\EduResourceAssignmentCreation' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'title' => null, + 'parent' => null, + 'sharing_description' => null, + 'sharing_description_html' => null, + 'resource' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'title' => false, + 'parent' => false, + 'sharing_description' => false, + 'sharing_description_html' => false, + 'resource' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'title' => 'title', + 'parent' => 'parent', + 'sharing_description' => 'sharingDescription', + 'sharing_description_html' => 'sharingDescriptionHtml', + 'resource' => 'resource' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'title' => 'setTitle', + 'parent' => 'setParent', + 'sharing_description' => 'setSharingDescription', + 'sharing_description_html' => 'setSharingDescriptionHtml', + 'resource' => 'setResource' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'title' => 'getTitle', + 'parent' => 'getParent', + 'sharing_description' => 'getSharingDescription', + 'sharing_description_html' => 'getSharingDescriptionHtml', + 'resource' => 'getResource' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('parent', $data ?? [], 'root'); + $this->setIfExists('sharing_description', $data ?? [], null); + $this->setIfExists('sharing_description_html', $data ?? [], null); + $this->setIfExists('resource', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['title'] === null) { + $invalidProperties[] = "'title' can't be null"; + } + if ((mb_strlen($this->container['title']) > 1000)) { + $invalidProperties[] = "invalid value for 'title', the character length must be smaller than or equal to 1000."; + } + + if ((mb_strlen($this->container['title']) < 1)) { + $invalidProperties[] = "invalid value for 'title', the character length must be bigger than or equal to 1."; + } + + if (!is_null($this->container['sharing_description']) && (mb_strlen($this->container['sharing_description']) > 400)) { + $invalidProperties[] = "invalid value for 'sharing_description', the character length must be smaller than or equal to 400."; + } + + if (!is_null($this->container['sharing_description_html']) && (mb_strlen($this->container['sharing_description_html']) > 10000)) { + $invalidProperties[] = "invalid value for 'sharing_description_html', the character length must be smaller than or equal to 10000."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return \Flat\APIClient\Model\EduResourceType + */ + public function getType(): \Flat\APIClient\Model\EduResourceType + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Flat\APIClient\Model\EduResourceType $type type + * + * @return $this + */ + public function setType(\Flat\APIClient\Model\EduResourceType $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets title + * + * @return string + */ + public function getTitle(): string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string $title Title of the resource + * + * @return $this + */ + public function setTitle(string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + if ((mb_strlen($title) > 1000)) { + throw new InvalidArgumentException('invalid length for $title when calling EduResourceCreation., must be smaller than or equal to 1000.'); + } + if ((mb_strlen($title) < 1)) { + throw new InvalidArgumentException('invalid length for $title when calling EduResourceCreation., must be bigger than or equal to 1.'); + } + + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets parent + * + * @return string|null + */ + public function getParent(): ?string + { + return $this->container['parent']; + } + + /** + * Sets parent + * + * @param string|null $parent Identifier of the parent resource where the new one will created, e.g. a folder id or `root` + * + * @return $this + */ + public function setParent(?string $parent): static + { + if (is_null($parent)) { + throw new InvalidArgumentException('non-nullable parent cannot be null'); + } + $this->container['parent'] = $parent; + + return $this; + } + + /** + * Gets sharing_description + * + * @return string|null + */ + public function getSharingDescription(): ?string + { + return $this->container['sharing_description']; + } + + /** + * Sets sharing_description + * + * @param string|null $sharing_description Sharing description of the resource + * + * @return $this + */ + public function setSharingDescription(?string $sharing_description): static + { + if (is_null($sharing_description)) { + throw new InvalidArgumentException('non-nullable sharing_description cannot be null'); + } + if ((mb_strlen($sharing_description) > 400)) { + throw new InvalidArgumentException('invalid length for $sharing_description when calling EduResourceCreation., must be smaller than or equal to 400.'); + } + + $this->container['sharing_description'] = $sharing_description; + + return $this; + } + + /** + * Gets sharing_description_html + * + * @return string|null + */ + public function getSharingDescriptionHtml(): ?string + { + return $this->container['sharing_description_html']; + } + + /** + * Sets sharing_description_html + * + * @param string|null $sharing_description_html HTML version of sharing description with rich text formatting. Supports safe HTML tags: p, br, strong, b, em, i, u, a. + * + * @return $this + */ + public function setSharingDescriptionHtml(?string $sharing_description_html): static + { + if (is_null($sharing_description_html)) { + throw new InvalidArgumentException('non-nullable sharing_description_html cannot be null'); + } + if ((mb_strlen($sharing_description_html) > 10000)) { + throw new InvalidArgumentException('invalid length for $sharing_description_html when calling EduResourceCreation., must be smaller than or equal to 10000.'); + } + + $this->container['sharing_description_html'] = $sharing_description_html; + + return $this; + } + + /** + * Gets resource + * + * @return \Flat\APIClient\Model\EduResourceAssignmentCreation|null + */ + public function getResource(): ?\Flat\APIClient\Model\EduResourceAssignmentCreation + { + return $this->container['resource']; + } + + /** + * Sets resource + * + * @param \Flat\APIClient\Model\EduResourceAssignmentCreation|null $resource resource + * + * @return $this + */ + public function setResource(?\Flat\APIClient\Model\EduResourceAssignmentCreation $resource): static + { + if (is_null($resource)) { + throw new InvalidArgumentException('non-nullable resource cannot be null'); + } + $this->container['resource'] = $resource; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/EduResourceFolder.php b/src/Model/EduResourceFolder.php new file mode 100644 index 0000000..ea7d105 --- /dev/null +++ b/src/Model/EduResourceFolder.php @@ -0,0 +1,453 @@ + + */ +class EduResourceFolder implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'EduResourceFolder'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'title' => 'string', + 'assignments_types' => '\Flat\APIClient\Model\AssignmentType[]', + 'resources_count' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'title' => null, + 'assignments_types' => null, + 'resources_count' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'title' => false, + 'assignments_types' => false, + 'resources_count' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'title' => 'title', + 'assignments_types' => 'assignmentsTypes', + 'resources_count' => 'resourcesCount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'title' => 'setTitle', + 'assignments_types' => 'setAssignmentsTypes', + 'resources_count' => 'setResourcesCount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'title' => 'getTitle', + 'assignments_types' => 'getAssignmentsTypes', + 'resources_count' => 'getResourcesCount' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('assignments_types', $data ?? [], null); + $this->setIfExists('resources_count', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets title + * + * @return string|null + */ + public function getTitle(): ?string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title Title of the folder + * + * @return $this + */ + public function setTitle(?string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets assignments_types + * + * @return \Flat\APIClient\Model\AssignmentType[]|null + */ + public function getAssignmentsTypes(): ?array + { + return $this->container['assignments_types']; + } + + /** + * Sets assignments_types + * + * @param \Flat\APIClient\Model\AssignmentType[]|null $assignments_types The assignment type of the resources that are included in the folder, + * + * @return $this + */ + public function setAssignmentsTypes(?array $assignments_types): static + { + if (is_null($assignments_types)) { + throw new InvalidArgumentException('non-nullable assignments_types cannot be null'); + } + $this->container['assignments_types'] = $assignments_types; + + return $this; + } + + /** + * Gets resources_count + * + * @return float|null + */ + public function getResourcesCount(): ?float + { + return $this->container['resources_count']; + } + + /** + * Sets resources_count + * + * @param float|null $resources_count The number of resources inside the folder + * + * @return $this + */ + public function setResourcesCount(?float $resources_count): static + { + if (is_null($resources_count)) { + throw new InvalidArgumentException('non-nullable resources_count cannot be null'); + } + $this->container['resources_count'] = $resources_count; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/EduResourceLtiLink.php b/src/Model/EduResourceLtiLink.php new file mode 100644 index 0000000..595e212 --- /dev/null +++ b/src/Model/EduResourceLtiLink.php @@ -0,0 +1,388 @@ + + */ +class EduResourceLtiLink implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'EduResourceLtiLink'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'lti_url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'lti_url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'lti_url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'lti_url' => 'ltiUrl' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'lti_url' => 'setLtiUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'lti_url' => 'getLtiUrl' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('lti_url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['lti_url'] === null) { + $invalidProperties[] = "'lti_url' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets lti_url + * + * @return string + */ + public function getLtiUrl(): string + { + return $this->container['lti_url']; + } + + /** + * Sets lti_url + * + * @param string $lti_url An URL that can be used to launch LTI with this resource in a classroom. + * + * @return $this + */ + public function setLtiUrl(string $lti_url): static + { + if (is_null($lti_url)) { + throw new InvalidArgumentException('non-nullable lti_url cannot be null'); + } + $this->container['lti_url'] = $lti_url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/EduResourceMove.php b/src/Model/EduResourceMove.php new file mode 100644 index 0000000..0610ed9 --- /dev/null +++ b/src/Model/EduResourceMove.php @@ -0,0 +1,388 @@ + + */ +class EduResourceMove implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'EduResourceMove'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'destination' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'destination' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'destination' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'destination' => 'destination' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'destination' => 'setDestination' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'destination' => 'getDestination' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('destination', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['destination'] === null) { + $invalidProperties[] = "'destination' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets destination + * + * @return string + */ + public function getDestination(): string + { + return $this->container['destination']; + } + + /** + * Sets destination + * + * @param string $destination Unique identifier of the destination of the folder where to move this resource. This can also be `root` to move the resource at the root of the user resource library. + * + * @return $this + */ + public function setDestination(string $destination): static + { + if (is_null($destination)) { + throw new InvalidArgumentException('non-nullable destination cannot be null'); + } + $this->container['destination'] = $destination; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/EduResourcePrivacy.php b/src/Model/EduResourcePrivacy.php new file mode 100644 index 0000000..ff42b46 --- /dev/null +++ b/src/Model/EduResourcePrivacy.php @@ -0,0 +1,48 @@ + + */ +class EduResourceUpdate implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'EduResourceUpdate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'title' => 'string', + 'sharing_description' => 'string', + 'sharing_description_html' => 'string', + 'privacy' => '\Flat\APIClient\Model\EduResourcePrivacy', + 'subjects' => '\Flat\APIClient\Model\TeachingTheme[]', + 'grades' => '\Flat\APIClient\Model\Grade[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'title' => null, + 'sharing_description' => null, + 'sharing_description_html' => null, + 'privacy' => null, + 'subjects' => null, + 'grades' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'title' => false, + 'sharing_description' => false, + 'sharing_description_html' => false, + 'privacy' => false, + 'subjects' => false, + 'grades' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'title' => 'title', + 'sharing_description' => 'sharingDescription', + 'sharing_description_html' => 'sharingDescriptionHtml', + 'privacy' => 'privacy', + 'subjects' => 'subjects', + 'grades' => 'grades' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'title' => 'setTitle', + 'sharing_description' => 'setSharingDescription', + 'sharing_description_html' => 'setSharingDescriptionHtml', + 'privacy' => 'setPrivacy', + 'subjects' => 'setSubjects', + 'grades' => 'setGrades' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'title' => 'getTitle', + 'sharing_description' => 'getSharingDescription', + 'sharing_description_html' => 'getSharingDescriptionHtml', + 'privacy' => 'getPrivacy', + 'subjects' => 'getSubjects', + 'grades' => 'getGrades' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('sharing_description', $data ?? [], null); + $this->setIfExists('sharing_description_html', $data ?? [], null); + $this->setIfExists('privacy', $data ?? [], null); + $this->setIfExists('subjects', $data ?? [], null); + $this->setIfExists('grades', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['title']) && (mb_strlen($this->container['title']) > 1000)) { + $invalidProperties[] = "invalid value for 'title', the character length must be smaller than or equal to 1000."; + } + + if (!is_null($this->container['title']) && (mb_strlen($this->container['title']) < 1)) { + $invalidProperties[] = "invalid value for 'title', the character length must be bigger than or equal to 1."; + } + + if (!is_null($this->container['sharing_description']) && (mb_strlen($this->container['sharing_description']) > 400)) { + $invalidProperties[] = "invalid value for 'sharing_description', the character length must be smaller than or equal to 400."; + } + + if (!is_null($this->container['sharing_description_html']) && (mb_strlen($this->container['sharing_description_html']) > 10000)) { + $invalidProperties[] = "invalid value for 'sharing_description_html', the character length must be smaller than or equal to 10000."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets title + * + * @return string|null + */ + public function getTitle(): ?string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title Title of the resource + * + * @return $this + */ + public function setTitle(?string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + if ((mb_strlen($title) > 1000)) { + throw new InvalidArgumentException('invalid length for $title when calling EduResourceUpdate., must be smaller than or equal to 1000.'); + } + if ((mb_strlen($title) < 1)) { + throw new InvalidArgumentException('invalid length for $title when calling EduResourceUpdate., must be bigger than or equal to 1.'); + } + + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets sharing_description + * + * @return string|null + */ + public function getSharingDescription(): ?string + { + return $this->container['sharing_description']; + } + + /** + * Sets sharing_description + * + * @param string|null $sharing_description Sharing description of the resource + * + * @return $this + */ + public function setSharingDescription(?string $sharing_description): static + { + if (is_null($sharing_description)) { + throw new InvalidArgumentException('non-nullable sharing_description cannot be null'); + } + if ((mb_strlen($sharing_description) > 400)) { + throw new InvalidArgumentException('invalid length for $sharing_description when calling EduResourceUpdate., must be smaller than or equal to 400.'); + } + + $this->container['sharing_description'] = $sharing_description; + + return $this; + } + + /** + * Gets sharing_description_html + * + * @return string|null + */ + public function getSharingDescriptionHtml(): ?string + { + return $this->container['sharing_description_html']; + } + + /** + * Sets sharing_description_html + * + * @param string|null $sharing_description_html HTML version of sharing description with rich text formatting. Supports safe HTML tags: p, br, strong, b, em, i, u, a. + * + * @return $this + */ + public function setSharingDescriptionHtml(?string $sharing_description_html): static + { + if (is_null($sharing_description_html)) { + throw new InvalidArgumentException('non-nullable sharing_description_html cannot be null'); + } + if ((mb_strlen($sharing_description_html) > 10000)) { + throw new InvalidArgumentException('invalid length for $sharing_description_html when calling EduResourceUpdate., must be smaller than or equal to 10000.'); + } + + $this->container['sharing_description_html'] = $sharing_description_html; + + return $this; + } + + /** + * Gets privacy + * + * @return \Flat\APIClient\Model\EduResourcePrivacy|null + */ + public function getPrivacy(): ?\Flat\APIClient\Model\EduResourcePrivacy + { + return $this->container['privacy']; + } + + /** + * Sets privacy + * + * @param \Flat\APIClient\Model\EduResourcePrivacy|null $privacy privacy + * + * @return $this + */ + public function setPrivacy(?\Flat\APIClient\Model\EduResourcePrivacy $privacy): static + { + if (is_null($privacy)) { + throw new InvalidArgumentException('non-nullable privacy cannot be null'); + } + $this->container['privacy'] = $privacy; + + return $this; + } + + /** + * Gets subjects + * + * @return \Flat\APIClient\Model\TeachingTheme[]|null + */ + public function getSubjects(): ?array + { + return $this->container['subjects']; + } + + /** + * Sets subjects + * + * @param \Flat\APIClient\Model\TeachingTheme[]|null $subjects The subjects of this resource, or the subjects of the resources included in the folder + * + * @return $this + */ + public function setSubjects(?array $subjects): static + { + if (is_null($subjects)) { + throw new InvalidArgumentException('non-nullable subjects cannot be null'); + } + $this->container['subjects'] = $subjects; + + return $this; + } + + /** + * Gets grades + * + * @return \Flat\APIClient\Model\Grade[]|null + */ + public function getGrades(): ?array + { + return $this->container['grades']; + } + + /** + * Sets grades + * + * @param \Flat\APIClient\Model\Grade[]|null $grades The grades of this resource, or the grades of the resources included in the folder. + * + * @return $this + */ + public function setGrades(?array $grades): static + { + if (is_null($grades)) { + throw new InvalidArgumentException('non-nullable grades cannot be null'); + } + $this->container['grades'] = $grades; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/EduResourceUseInClass.php b/src/Model/EduResourceUseInClass.php new file mode 100644 index 0000000..5bbcbcc --- /dev/null +++ b/src/Model/EduResourceUseInClass.php @@ -0,0 +1,422 @@ + + */ +class EduResourceUseInClass implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'EduResourceUseInClass'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'classroom' => 'string', + 'assignment' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'classroom' => null, + 'assignment' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'classroom' => false, + 'assignment' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'classroom' => 'classroom', + 'assignment' => 'assignment' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'classroom' => 'setClassroom', + 'assignment' => 'setAssignment' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'classroom' => 'getClassroom', + 'assignment' => 'getAssignment' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('classroom', $data ?? [], null); + $this->setIfExists('assignment', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['classroom'] === null) { + $invalidProperties[] = "'classroom' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets classroom + * + * @return string + */ + public function getClassroom(): string + { + return $this->container['classroom']; + } + + /** + * Sets classroom + * + * @param string $classroom The destination classroom where the resource will be copied. + * + * @return $this + */ + public function setClassroom(string $classroom): static + { + if (is_null($classroom)) { + throw new InvalidArgumentException('non-nullable classroom cannot be null'); + } + $this->container['classroom'] = $classroom; + + return $this; + } + + /** + * Gets assignment + * + * @return string|null + */ + public function getAssignment(): ?string + { + return $this->container['assignment']; + } + + /** + * Sets assignment + * + * @param string|null $assignment An optional destination assignment where the original assignement will be copied. Must be a draft. + * + * @return $this + */ + public function setAssignment(?string $assignment): static + { + if (is_null($assignment)) { + throw new InvalidArgumentException('non-nullable assignment cannot be null'); + } + $this->container['assignment'] = $assignment; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/FlatErrorResponse.php b/src/Model/FlatErrorResponse.php new file mode 100644 index 0000000..4110e91 --- /dev/null +++ b/src/Model/FlatErrorResponse.php @@ -0,0 +1,527 @@ + + */ +class FlatErrorResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'FlatErrorResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'code' => 'string', + 'message' => 'string', + 'id' => 'string', + 'param' => 'string', + 'provider_message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'code' => null, + 'message' => null, + 'id' => null, + 'param' => null, + 'provider_message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'code' => false, + 'message' => false, + 'id' => false, + 'param' => false, + 'provider_message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'code' => 'code', + 'message' => 'message', + 'id' => 'id', + 'param' => 'param', + 'provider_message' => 'providerMessage' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'code' => 'setCode', + 'message' => 'setMessage', + 'id' => 'setId', + 'param' => 'setParam', + 'provider_message' => 'setProviderMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'code' => 'getCode', + 'message' => 'getMessage', + 'id' => 'getId', + 'param' => 'getParam', + 'provider_message' => 'getProviderMessage' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('param', $data ?? [], null); + $this->setIfExists('provider_message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['code'] === null) { + $invalidProperties[] = "'code' can't be null"; + } + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets code + * + * @return string + */ + public function getCode(): string + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string $code A corresponding code for this error + * + * @return $this + */ + public function setCode(string $code): static + { + if (is_null($code)) { + throw new InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage(): string + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message A printable message for this error + * + * @return $this + */ + public function setMessage(string $message): static + { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id An unique error identifier generated for the request + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets param + * + * @return string|null + */ + public function getParam(): ?string + { + return $this->container['param']; + } + + /** + * Sets param + * + * @param string|null $param The related parameter that caused the error + * + * @return $this + */ + public function setParam(?string $param): static + { + if (is_null($param)) { + throw new InvalidArgumentException('non-nullable param cannot be null'); + } + $this->container['param'] = $param; + + return $this; + } + + /** + * Gets provider_message + * + * @return string|null + */ + public function getProviderMessage(): ?string + { + return $this->container['provider_message']; + } + + /** + * Sets provider_message + * + * @param string|null $provider_message The untranslated error message returned by an external provider (e.g. Google Classroom), when the error originates from one. Only set on errors forwarded from a third party. Meant for support and IT: display it alongside `message`, never in place of it. `message` is the localized, user-facing text; this field is raw provider output and is always in English. + * + * @return $this + */ + public function setProviderMessage(?string $provider_message): static + { + if (is_null($provider_message)) { + throw new InvalidArgumentException('non-nullable provider_message cannot be null'); + } + $this->container['provider_message'] = $provider_message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/GoogleClassroomCoursework.php b/src/Model/GoogleClassroomCoursework.php new file mode 100644 index 0000000..0ba6cdf --- /dev/null +++ b/src/Model/GoogleClassroomCoursework.php @@ -0,0 +1,494 @@ + + */ +class GoogleClassroomCoursework implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GoogleClassroomCoursework'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'state' => 'string', + 'alternate_link' => 'string', + 'topic_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'state' => null, + 'alternate_link' => null, + 'topic_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'state' => false, + 'alternate_link' => false, + 'topic_id' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'state' => 'state', + 'alternate_link' => 'alternateLink', + 'topic_id' => 'topicId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'state' => 'setState', + 'alternate_link' => 'setAlternateLink', + 'topic_id' => 'setTopicId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'state' => 'getState', + 'alternate_link' => 'getAlternateLink', + 'topic_id' => 'getTopicId' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('alternate_link', $data ?? [], null); + $this->setIfExists('topic_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Identifier of the coursework assigned by Classroom + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState(): ?string + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state State of the coursework + * + * @return $this + */ + public function setState(?string $state): static + { + if (is_null($state)) { + throw new InvalidArgumentException('non-nullable state cannot be null'); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets alternate_link + * + * @return string|null + */ + public function getAlternateLink(): ?string + { + return $this->container['alternate_link']; + } + + /** + * Sets alternate_link + * + * @param string|null $alternate_link Absolute link to this coursework in the Classroom web UI + * + * @return $this + */ + public function setAlternateLink(?string $alternate_link): static + { + if (is_null($alternate_link)) { + throw new InvalidArgumentException('non-nullable alternate_link cannot be null'); + } + $this->container['alternate_link'] = $alternate_link; + + return $this; + } + + /** + * Gets topic_id + * + * @return string|null + */ + public function getTopicId(): ?string + { + return $this->container['topic_id']; + } + + /** + * Sets topic_id + * + * @param string|null $topic_id Identifier of the topic where the assignment is created + * + * @return $this + */ + public function setTopicId(?string $topic_id): static + { + if (is_null($topic_id)) { + array_push($this->openAPINullablesSetToNull, 'topic_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('topic_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['topic_id'] = $topic_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/GoogleClassroomSubmission.php b/src/Model/GoogleClassroomSubmission.php new file mode 100644 index 0000000..c29ce19 --- /dev/null +++ b/src/Model/GoogleClassroomSubmission.php @@ -0,0 +1,462 @@ + + */ +class GoogleClassroomSubmission implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GoogleClassroomSubmission'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'state' => 'string', + 'alternate_link' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'state' => null, + 'alternate_link' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'state' => false, + 'alternate_link' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'state' => 'state', + 'alternate_link' => 'alternateLink' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'state' => 'setState', + 'alternate_link' => 'setAlternateLink' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'state' => 'getState', + 'alternate_link' => 'getAlternateLink' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('alternate_link', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['state'] === null) { + $invalidProperties[] = "'state' can't be null"; + } + if ($this->container['alternate_link'] === null) { + $invalidProperties[] = "'alternate_link' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Identifier of the coursework submission assigned by Classroom + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets state + * + * @return string + */ + public function getState(): string + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string $state State of the submission on Google Classroom + * + * @return $this + */ + public function setState(string $state): static + { + if (is_null($state)) { + throw new InvalidArgumentException('non-nullable state cannot be null'); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets alternate_link + * + * @return string + */ + public function getAlternateLink(): string + { + return $this->container['alternate_link']; + } + + /** + * Sets alternate_link + * + * @param string $alternate_link Absolute link to this coursework in the Classroom web UI + * + * @return $this + */ + public function setAlternateLink(string $alternate_link): static + { + if (is_null($alternate_link)) { + throw new InvalidArgumentException('non-nullable alternate_link cannot be null'); + } + $this->container['alternate_link'] = $alternate_link; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/Grade.php b/src/Model/Grade.php new file mode 100644 index 0000000..4f8e353 --- /dev/null +++ b/src/Model/Grade.php @@ -0,0 +1,68 @@ + + */ +class Group implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'Group'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'type' => '\Flat\APIClient\Model\GroupType', + 'users_count' => 'float', + 'read_only' => 'bool', + 'organization' => 'string', + 'creation_date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'type' => null, + 'users_count' => null, + 'read_only' => null, + 'organization' => null, + 'creation_date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'type' => false, + 'users_count' => false, + 'read_only' => false, + 'organization' => false, + 'creation_date' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'type' => 'type', + 'users_count' => 'usersCount', + 'read_only' => 'readOnly', + 'organization' => 'organization', + 'creation_date' => 'creationDate' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'type' => 'setType', + 'users_count' => 'setUsersCount', + 'read_only' => 'setReadOnly', + 'organization' => 'setOrganization', + 'creation_date' => 'setCreationDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'type' => 'getType', + 'users_count' => 'getUsersCount', + 'read_only' => 'getReadOnly', + 'organization' => 'getOrganization', + 'creation_date' => 'getCreationDate' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('users_count', $data ?? [], null); + $this->setIfExists('read_only', $data ?? [], null); + $this->setIfExists('organization', $data ?? [], null); + $this->setIfExists('creation_date', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The unique identifier of the group + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The display name of the group + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets type + * + * @return \Flat\APIClient\Model\GroupType|null + */ + public function getType(): ?\Flat\APIClient\Model\GroupType + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Flat\APIClient\Model\GroupType|null $type type + * + * @return $this + */ + public function setType(?\Flat\APIClient\Model\GroupType $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets users_count + * + * @return float|null + */ + public function getUsersCount(): ?float + { + return $this->container['users_count']; + } + + /** + * Sets users_count + * + * @param float|null $users_count The number of users in this group + * + * @return $this + */ + public function setUsersCount(?float $users_count): static + { + if (is_null($users_count)) { + throw new InvalidArgumentException('non-nullable users_count cannot be null'); + } + $this->container['users_count'] = $users_count; + + return $this; + } + + /** + * Gets read_only + * + * @return bool|null + */ + public function getReadOnly(): ?bool + { + return $this->container['read_only']; + } + + /** + * Sets read_only + * + * @param bool|null $read_only `True` if the group is set in read-only + * + * @return $this + */ + public function setReadOnly(?bool $read_only): static + { + if (is_null($read_only)) { + throw new InvalidArgumentException('non-nullable read_only cannot be null'); + } + $this->container['read_only'] = $read_only; + + return $this; + } + + /** + * Gets organization + * + * @return string|null + */ + public function getOrganization(): ?string + { + return $this->container['organization']; + } + + /** + * Sets organization + * + * @param string|null $organization If the group is related to an organization, this field will contain the unique identifier of the organization + * + * @return $this + */ + public function setOrganization(?string $organization): static + { + if (is_null($organization)) { + throw new InvalidArgumentException('non-nullable organization cannot be null'); + } + $this->container['organization'] = $organization; + + return $this; + } + + /** + * Gets creation_date + * + * @return \DateTime|null + */ + public function getCreationDate(): ?\DateTime + { + return $this->container['creation_date']; + } + + /** + * Sets creation_date + * + * @param \DateTime|null $creation_date The creation date of the group + * + * @return $this + */ + public function setCreationDate(?\DateTime $creation_date): static + { + if (is_null($creation_date)) { + throw new InvalidArgumentException('non-nullable creation_date cannot be null'); + } + $this->container['creation_date'] = $creation_date; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/GroupCreation.php b/src/Model/GroupCreation.php new file mode 100644 index 0000000..a895496 --- /dev/null +++ b/src/Model/GroupCreation.php @@ -0,0 +1,524 @@ + + */ +class GroupCreation implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GroupCreation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => 'string', + 'classroom' => 'string', + 'name' => 'string', + 'members' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'classroom' => null, + 'name' => null, + 'members' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'classroom' => false, + 'name' => false, + 'members' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'classroom' => 'classroom', + 'name' => 'name', + 'members' => 'members' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'classroom' => 'setClassroom', + 'name' => 'setName', + 'members' => 'setMembers' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'classroom' => 'getClassroom', + 'name' => 'getName', + 'members' => 'getMembers' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const TYPE_CLASS_STUDENTS_SUB_GROUP = 'classStudentsSubGroup'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getTypeAllowableValues() + { + return [ + self::TYPE_CLASS_STUDENTS_SUB_GROUP, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('classroom', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('members', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + $allowedValues = self::getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['classroom'] === null) { + $invalidProperties[] = "'classroom' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string + */ + public function getType(): string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type Type of group (currently only classStudentsSubGroup is supported) + * + * @return $this + */ + public function setType(string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = self::getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets classroom + * + * @return string + */ + public function getClassroom(): string + { + return $this->container['classroom']; + } + + /** + * Sets classroom + * + * @param string $classroom Classroom ID + * + * @return $this + */ + public function setClassroom(string $classroom): static + { + if (is_null($classroom)) { + throw new InvalidArgumentException('non-nullable classroom cannot be null'); + } + $this->container['classroom'] = $classroom; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the group (optional - auto-generated if not provided). **Special names:** * `edu:testing-students`: Creates a group tagged for test student accounts. The display name will be localized (e.g., \"Test Students\") and the group will be tagged with `edu:testing-students`. + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets members + * + * @return string[]|null + */ + public function getMembers(): ?array + { + return $this->container['members']; + } + + /** + * Sets members + * + * @param string[]|null $members Array of student IDs to add to the group + * + * @return $this + */ + public function setMembers(?array $members): static + { + if (is_null($members)) { + throw new InvalidArgumentException('non-nullable members cannot be null'); + } + $this->container['members'] = $members; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/GroupDetails.php b/src/Model/GroupDetails.php new file mode 100644 index 0000000..8801fd0 --- /dev/null +++ b/src/Model/GroupDetails.php @@ -0,0 +1,746 @@ + + */ +class GroupDetails implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GroupDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'type' => '\Flat\APIClient\Model\GroupType', + 'organization' => 'string', + 'classroom' => 'string', + 'assignment' => 'string', + 'parent' => 'string', + 'creation_date' => '\DateTime', + 'users_count' => 'float', + 'read_only' => 'bool', + 'tags' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'type' => null, + 'organization' => null, + 'classroom' => null, + 'assignment' => null, + 'parent' => null, + 'creation_date' => 'date-time', + 'users_count' => null, + 'read_only' => null, + 'tags' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'type' => false, + 'organization' => false, + 'classroom' => false, + 'assignment' => false, + 'parent' => false, + 'creation_date' => false, + 'users_count' => false, + 'read_only' => false, + 'tags' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'type' => 'type', + 'organization' => 'organization', + 'classroom' => 'classroom', + 'assignment' => 'assignment', + 'parent' => 'parent', + 'creation_date' => 'creationDate', + 'users_count' => 'usersCount', + 'read_only' => 'readOnly', + 'tags' => 'tags' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'type' => 'setType', + 'organization' => 'setOrganization', + 'classroom' => 'setClassroom', + 'assignment' => 'setAssignment', + 'parent' => 'setParent', + 'creation_date' => 'setCreationDate', + 'users_count' => 'setUsersCount', + 'read_only' => 'setReadOnly', + 'tags' => 'setTags' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'type' => 'getType', + 'organization' => 'getOrganization', + 'classroom' => 'getClassroom', + 'assignment' => 'getAssignment', + 'parent' => 'getParent', + 'creation_date' => 'getCreationDate', + 'users_count' => 'getUsersCount', + 'read_only' => 'getReadOnly', + 'tags' => 'getTags' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('organization', $data ?? [], null); + $this->setIfExists('classroom', $data ?? [], null); + $this->setIfExists('assignment', $data ?? [], null); + $this->setIfExists('parent', $data ?? [], null); + $this->setIfExists('creation_date', $data ?? [], null); + $this->setIfExists('users_count', $data ?? [], null); + $this->setIfExists('read_only', $data ?? [], null); + $this->setIfExists('tags', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['creation_date'] === null) { + $invalidProperties[] = "'creation_date' can't be null"; + } + if ($this->container['users_count'] === null) { + $invalidProperties[] = "'users_count' can't be null"; + } + if ($this->container['read_only'] === null) { + $invalidProperties[] = "'read_only' can't be null"; + } + if ($this->container['tags'] === null) { + $invalidProperties[] = "'tags' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The unique identifier of the group + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName(): string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name The displayable name of the group + * + * @return $this + */ + public function setName(string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets type + * + * @return \Flat\APIClient\Model\GroupType + */ + public function getType(): \Flat\APIClient\Model\GroupType + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Flat\APIClient\Model\GroupType $type type + * + * @return $this + */ + public function setType(\Flat\APIClient\Model\GroupType $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets organization + * + * @return string|null + */ + public function getOrganization(): ?string + { + return $this->container['organization']; + } + + /** + * Sets organization + * + * @param string|null $organization The unique identifier of the Organization owning the group + * + * @return $this + */ + public function setOrganization(?string $organization): static + { + if (is_null($organization)) { + throw new InvalidArgumentException('non-nullable organization cannot be null'); + } + $this->container['organization'] = $organization; + + return $this; + } + + /** + * Gets classroom + * + * @return string|null + */ + public function getClassroom(): ?string + { + return $this->container['classroom']; + } + + /** + * Sets classroom + * + * @param string|null $classroom The unique identifier of the classroom owning the group. Only available for groups of type 'classromStudentsSubGroup' or 'assignmentStudentsSubGroup' + * + * @return $this + */ + public function setClassroom(?string $classroom): static + { + if (is_null($classroom)) { + throw new InvalidArgumentException('non-nullable classroom cannot be null'); + } + $this->container['classroom'] = $classroom; + + return $this; + } + + /** + * Gets assignment + * + * @return string|null + */ + public function getAssignment(): ?string + { + return $this->container['assignment']; + } + + /** + * Sets assignment + * + * @param string|null $assignment The unique identifier of the assignment owning the group. Only available for groups of type 'assignmentStudentsSubGroup'. + * + * @return $this + */ + public function setAssignment(?string $assignment): static + { + if (is_null($assignment)) { + throw new InvalidArgumentException('non-nullable assignment cannot be null'); + } + $this->container['assignment'] = $assignment; + + return $this; + } + + /** + * Gets parent + * + * @return string|null + */ + public function getParent(): ?string + { + return $this->container['parent']; + } + + /** + * Sets parent + * + * @param string|null $parent The unique identifier of the parent class group. Only available for groups of type 'assignmentStudentsSubGroup'. May be null if the parent class group was deleted. + * + * @return $this + */ + public function setParent(?string $parent): static + { + if (is_null($parent)) { + throw new InvalidArgumentException('non-nullable parent cannot be null'); + } + $this->container['parent'] = $parent; + + return $this; + } + + /** + * Gets creation_date + * + * @return \DateTime + */ + public function getCreationDate(): \DateTime + { + return $this->container['creation_date']; + } + + /** + * Sets creation_date + * + * @param \DateTime $creation_date The date when the group was create + * + * @return $this + */ + public function setCreationDate(\DateTime $creation_date): static + { + if (is_null($creation_date)) { + throw new InvalidArgumentException('non-nullable creation_date cannot be null'); + } + $this->container['creation_date'] = $creation_date; + + return $this; + } + + /** + * Gets users_count + * + * @return float + */ + public function getUsersCount(): float + { + return $this->container['users_count']; + } + + /** + * Sets users_count + * + * @param float $users_count The number of students in this group + * + * @return $this + */ + public function setUsersCount(float $users_count): static + { + if (is_null($users_count)) { + throw new InvalidArgumentException('non-nullable users_count cannot be null'); + } + $this->container['users_count'] = $users_count; + + return $this; + } + + /** + * Gets read_only + * + * @return bool + */ + public function getReadOnly(): bool + { + return $this->container['read_only']; + } + + /** + * Sets read_only + * + * @param bool $read_only `true` if the properties and members of this group are in in read-only + * + * @return $this + */ + public function setReadOnly(bool $read_only): static + { + if (is_null($read_only)) { + throw new InvalidArgumentException('non-nullable read_only cannot be null'); + } + $this->container['read_only'] = $read_only; + + return $this; + } + + /** + * Gets tags + * + * @return string[] + */ + public function getTags(): array + { + return $this->container['tags']; + } + + /** + * Sets tags + * + * @param string[] $tags Tags for categorizing groups. * `edu:testing-students`: Marks this group as containing test student accounts + * + * @return $this + */ + public function setTags(array $tags): static + { + if (is_null($tags)) { + throw new InvalidArgumentException('non-nullable tags cannot be null'); + } + $this->container['tags'] = $tags; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/GroupType.php b/src/Model/GroupType.php new file mode 100644 index 0000000..054703b --- /dev/null +++ b/src/Model/GroupType.php @@ -0,0 +1,52 @@ + '\Flat\APIClient\Model\LtiConfiguration1p1', + '1p3' => '\Flat\APIClient\Model\LtiConfiguration1p3' + ]; + } +} + + diff --git a/src/Model/LtiConfiguration1p1.php b/src/Model/LtiConfiguration1p1.php new file mode 100644 index 0000000..961363c --- /dev/null +++ b/src/Model/LtiConfiguration1p1.php @@ -0,0 +1,869 @@ + + */ +class LtiConfiguration1p1 implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'LtiConfiguration1p1'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'lti_version' => 'string', + 'organization_id' => 'string', + 'organization_name' => 'string', + 'creator_id' => 'string', + 'creation_date' => '\DateTime', + 'last_used_date' => '\DateTime', + 'status' => 'string', + 'consumer_key' => 'string', + 'consumer_secret' => 'string', + 'lms' => 'string', + 'name' => 'string', + 'tool' => '\Flat\APIClient\Model\LtiConfiguration1p1AllOfTool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'lti_version' => null, + 'organization_id' => null, + 'organization_name' => null, + 'creator_id' => null, + 'creation_date' => 'date-time', + 'last_used_date' => 'date-time', + 'status' => null, + 'consumer_key' => null, + 'consumer_secret' => null, + 'lms' => null, + 'name' => null, + 'tool' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'lti_version' => false, + 'organization_id' => false, + 'organization_name' => false, + 'creator_id' => false, + 'creation_date' => false, + 'last_used_date' => false, + 'status' => false, + 'consumer_key' => false, + 'consumer_secret' => false, + 'lms' => false, + 'name' => false, + 'tool' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'lti_version' => 'ltiVersion', + 'organization_id' => 'organizationId', + 'organization_name' => 'organizationName', + 'creator_id' => 'creatorId', + 'creation_date' => 'creationDate', + 'last_used_date' => 'lastUsedDate', + 'status' => 'status', + 'consumer_key' => 'consumerKey', + 'consumer_secret' => 'consumerSecret', + 'lms' => 'lms', + 'name' => 'name', + 'tool' => 'tool' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'lti_version' => 'setLtiVersion', + 'organization_id' => 'setOrganizationId', + 'organization_name' => 'setOrganizationName', + 'creator_id' => 'setCreatorId', + 'creation_date' => 'setCreationDate', + 'last_used_date' => 'setLastUsedDate', + 'status' => 'setStatus', + 'consumer_key' => 'setConsumerKey', + 'consumer_secret' => 'setConsumerSecret', + 'lms' => 'setLms', + 'name' => 'setName', + 'tool' => 'setTool' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'lti_version' => 'getLtiVersion', + 'organization_id' => 'getOrganizationId', + 'organization_name' => 'getOrganizationName', + 'creator_id' => 'getCreatorId', + 'creation_date' => 'getCreationDate', + 'last_used_date' => 'getLastUsedDate', + 'status' => 'getStatus', + 'consumer_key' => 'getConsumerKey', + 'consumer_secret' => 'getConsumerSecret', + 'lms' => 'getLms', + 'name' => 'getName', + 'tool' => 'getTool' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const LTI_VERSION__1P1 = '1p1'; + public const STATUS_READY_TO_USE = 'ready-to-use'; + public const STATUS_IN_USE = 'in-use'; + public const STATUS_INCOMPLETE_SETUP = 'incomplete-setup'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getLtiVersionAllowableValues() + { + return [ + self::LTI_VERSION__1P1, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getStatusAllowableValues() + { + return [ + self::STATUS_READY_TO_USE, + self::STATUS_IN_USE, + self::STATUS_INCOMPLETE_SETUP, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('lti_version', $data ?? [], null); + $this->setIfExists('organization_id', $data ?? [], null); + $this->setIfExists('organization_name', $data ?? [], null); + $this->setIfExists('creator_id', $data ?? [], null); + $this->setIfExists('creation_date', $data ?? [], null); + $this->setIfExists('last_used_date', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('consumer_key', $data ?? [], null); + $this->setIfExists('consumer_secret', $data ?? [], null); + $this->setIfExists('lms', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('tool', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['lti_version'] === null) { + $invalidProperties[] = "'lti_version' can't be null"; + } + $allowedValues = self::getLtiVersionAllowableValues(); + if (!is_null($this->container['lti_version']) && !in_array($this->container['lti_version'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'lti_version', must be one of '%s'", + $this->container['lti_version'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['creation_date'] === null) { + $invalidProperties[] = "'creation_date' can't be null"; + } + $allowedValues = self::getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Configuration ID + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets lti_version + * + * @return string + */ + public function getLtiVersion(): string + { + return $this->container['lti_version']; + } + + /** + * Sets lti_version + * + * @param string $lti_version LTI version (1.1) + * + * @return $this + */ + public function setLtiVersion(string $lti_version): static + { + if (is_null($lti_version)) { + throw new InvalidArgumentException('non-nullable lti_version cannot be null'); + } + $allowedValues = self::getLtiVersionAllowableValues(); + if (!in_array($lti_version, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'lti_version', must be one of '%s'", + $lti_version, + implode("', '", $allowedValues) + ) + ); + } + $this->container['lti_version'] = $lti_version; + + return $this; + } + + /** + * Gets organization_id + * + * @return string|null + */ + public function getOrganizationId(): ?string + { + return $this->container['organization_id']; + } + + /** + * Sets organization_id + * + * @param string|null $organization_id Organization ID + * + * @return $this + */ + public function setOrganizationId(?string $organization_id): static + { + if (is_null($organization_id)) { + throw new InvalidArgumentException('non-nullable organization_id cannot be null'); + } + $this->container['organization_id'] = $organization_id; + + return $this; + } + + /** + * Gets organization_name + * + * @return string|null + */ + public function getOrganizationName(): ?string + { + return $this->container['organization_name']; + } + + /** + * Sets organization_name + * + * @param string|null $organization_name Organization name + * + * @return $this + */ + public function setOrganizationName(?string $organization_name): static + { + if (is_null($organization_name)) { + throw new InvalidArgumentException('non-nullable organization_name cannot be null'); + } + $this->container['organization_name'] = $organization_name; + + return $this; + } + + /** + * Gets creator_id + * + * @return string|null + */ + public function getCreatorId(): ?string + { + return $this->container['creator_id']; + } + + /** + * Sets creator_id + * + * @param string|null $creator_id ID of the user who created this configuration + * + * @return $this + */ + public function setCreatorId(?string $creator_id): static + { + if (is_null($creator_id)) { + throw new InvalidArgumentException('non-nullable creator_id cannot be null'); + } + $this->container['creator_id'] = $creator_id; + + return $this; + } + + /** + * Gets creation_date + * + * @return \DateTime + */ + public function getCreationDate(): \DateTime + { + return $this->container['creation_date']; + } + + /** + * Sets creation_date + * + * @param \DateTime $creation_date Configuration creation date + * + * @return $this + */ + public function setCreationDate(\DateTime $creation_date): static + { + if (is_null($creation_date)) { + throw new InvalidArgumentException('non-nullable creation_date cannot be null'); + } + $this->container['creation_date'] = $creation_date; + + return $this; + } + + /** + * Gets last_used_date + * + * @return \DateTime|null + */ + public function getLastUsedDate(): ?\DateTime + { + return $this->container['last_used_date']; + } + + /** + * Sets last_used_date + * + * @param \DateTime|null $last_used_date Last time this configuration was used + * + * @return $this + */ + public function setLastUsedDate(?\DateTime $last_used_date): static + { + if (is_null($last_used_date)) { + throw new InvalidArgumentException('non-nullable last_used_date cannot be null'); + } + $this->container['last_used_date'] = $last_used_date; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus(): ?string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Configuration status indicator + * + * @return $this + */ + public function setStatus(?string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = self::getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets consumer_key + * + * @return string|null + */ + public function getConsumerKey(): ?string + { + return $this->container['consumer_key']; + } + + /** + * Sets consumer_key + * + * @param string|null $consumer_key LTI 1.1 consumer key + * + * @return $this + */ + public function setConsumerKey(?string $consumer_key): static + { + if (is_null($consumer_key)) { + throw new InvalidArgumentException('non-nullable consumer_key cannot be null'); + } + $this->container['consumer_key'] = $consumer_key; + + return $this; + } + + /** + * Gets consumer_secret + * + * @return string|null + */ + public function getConsumerSecret(): ?string + { + return $this->container['consumer_secret']; + } + + /** + * Sets consumer_secret + * + * @param string|null $consumer_secret LTI 1.1 consumer secret (only included for admins) + * + * @return $this + */ + public function setConsumerSecret(?string $consumer_secret): static + { + if (is_null($consumer_secret)) { + throw new InvalidArgumentException('non-nullable consumer_secret cannot be null'); + } + $this->container['consumer_secret'] = $consumer_secret; + + return $this; + } + + /** + * Gets lms + * + * @return string|null + */ + public function getLms(): ?string + { + return $this->container['lms']; + } + + /** + * Sets lms + * + * @param string|null $lms LMS type + * + * @return $this + */ + public function setLms(?string $lms): static + { + if (is_null($lms)) { + throw new InvalidArgumentException('non-nullable lms cannot be null'); + } + $this->container['lms'] = $lms; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Configuration name + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets tool + * + * @return \Flat\APIClient\Model\LtiConfiguration1p1AllOfTool|null + */ + public function getTool(): ?\Flat\APIClient\Model\LtiConfiguration1p1AllOfTool + { + return $this->container['tool']; + } + + /** + * Sets tool + * + * @param \Flat\APIClient\Model\LtiConfiguration1p1AllOfTool|null $tool tool + * + * @return $this + */ + public function setTool(?\Flat\APIClient\Model\LtiConfiguration1p1AllOfTool $tool): static + { + if (is_null($tool)) { + throw new InvalidArgumentException('non-nullable tool cannot be null'); + } + $this->container['tool'] = $tool; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LtiConfiguration1p1AllOfTool.php b/src/Model/LtiConfiguration1p1AllOfTool.php new file mode 100644 index 0000000..ffcecb0 --- /dev/null +++ b/src/Model/LtiConfiguration1p1AllOfTool.php @@ -0,0 +1,555 @@ + + */ +class LtiConfiguration1p1AllOfTool implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'LtiConfiguration1p1_allOf_tool'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'product' => 'string', + 'version' => 'string', + 'instance_name' => 'string', + 'instance_guid' => 'string', + 'instance_contact' => 'string', + 'instance_domain' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'product' => null, + 'version' => null, + 'instance_name' => null, + 'instance_guid' => null, + 'instance_contact' => null, + 'instance_domain' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'product' => false, + 'version' => false, + 'instance_name' => false, + 'instance_guid' => false, + 'instance_contact' => false, + 'instance_domain' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'product' => 'product', + 'version' => 'version', + 'instance_name' => 'instanceName', + 'instance_guid' => 'instanceGuid', + 'instance_contact' => 'instanceContact', + 'instance_domain' => 'instanceDomain' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'product' => 'setProduct', + 'version' => 'setVersion', + 'instance_name' => 'setInstanceName', + 'instance_guid' => 'setInstanceGuid', + 'instance_contact' => 'setInstanceContact', + 'instance_domain' => 'setInstanceDomain' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'product' => 'getProduct', + 'version' => 'getVersion', + 'instance_name' => 'getInstanceName', + 'instance_guid' => 'getInstanceGuid', + 'instance_contact' => 'getInstanceContact', + 'instance_domain' => 'getInstanceDomain' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('product', $data ?? [], null); + $this->setIfExists('version', $data ?? [], null); + $this->setIfExists('instance_name', $data ?? [], null); + $this->setIfExists('instance_guid', $data ?? [], null); + $this->setIfExists('instance_contact', $data ?? [], null); + $this->setIfExists('instance_domain', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets product + * + * @return string|null + */ + public function getProduct(): ?string + { + return $this->container['product']; + } + + /** + * Sets product + * + * @param string|null $product Product family code (e.g., canvas, moodle, schoology) + * + * @return $this + */ + public function setProduct(?string $product): static + { + if (is_null($product)) { + throw new InvalidArgumentException('non-nullable product cannot be null'); + } + $this->container['product'] = $product; + + return $this; + } + + /** + * Gets version + * + * @return string|null + */ + public function getVersion(): ?string + { + return $this->container['version']; + } + + /** + * Sets version + * + * @param string|null $version Platform version string + * + * @return $this + */ + public function setVersion(?string $version): static + { + if (is_null($version)) { + throw new InvalidArgumentException('non-nullable version cannot be null'); + } + $this->container['version'] = $version; + + return $this; + } + + /** + * Gets instance_name + * + * @return string|null + */ + public function getInstanceName(): ?string + { + return $this->container['instance_name']; + } + + /** + * Sets instance_name + * + * @param string|null $instance_name Instance display name + * + * @return $this + */ + public function setInstanceName(?string $instance_name): static + { + if (is_null($instance_name)) { + throw new InvalidArgumentException('non-nullable instance_name cannot be null'); + } + $this->container['instance_name'] = $instance_name; + + return $this; + } + + /** + * Gets instance_guid + * + * @return string|null + */ + public function getInstanceGuid(): ?string + { + return $this->container['instance_guid']; + } + + /** + * Sets instance_guid + * + * @param string|null $instance_guid Unique instance identifier + * + * @return $this + */ + public function setInstanceGuid(?string $instance_guid): static + { + if (is_null($instance_guid)) { + throw new InvalidArgumentException('non-nullable instance_guid cannot be null'); + } + $this->container['instance_guid'] = $instance_guid; + + return $this; + } + + /** + * Gets instance_contact + * + * @return string|null + */ + public function getInstanceContact(): ?string + { + return $this->container['instance_contact']; + } + + /** + * Sets instance_contact + * + * @param string|null $instance_contact Contact email or handle for the instance + * + * @return $this + */ + public function setInstanceContact(?string $instance_contact): static + { + if (is_null($instance_contact)) { + throw new InvalidArgumentException('non-nullable instance_contact cannot be null'); + } + $this->container['instance_contact'] = $instance_contact; + + return $this; + } + + /** + * Gets instance_domain + * + * @return string|null + */ + public function getInstanceDomain(): ?string + { + return $this->container['instance_domain']; + } + + /** + * Sets instance_domain + * + * @param string|null $instance_domain Instance root domain + * + * @return $this + */ + public function setInstanceDomain(?string $instance_domain): static + { + if (is_null($instance_domain)) { + throw new InvalidArgumentException('non-nullable instance_domain cannot be null'); + } + $this->container['instance_domain'] = $instance_domain; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LtiConfiguration1p3.php b/src/Model/LtiConfiguration1p3.php new file mode 100644 index 0000000..18894ab --- /dev/null +++ b/src/Model/LtiConfiguration1p3.php @@ -0,0 +1,86 @@ + + */ +class LtiConfiguration1p3Base implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'LtiConfiguration1p3Base'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'mode' => 'string', + 'platform_iss' => 'string', + 'platform_name' => 'string', + 'client_id' => 'string', + 'deployment_id' => 'string', + 'access_token_url' => 'string', + 'authorization_url' => 'string', + 'jwks_url' => 'string', + 'deployment_mode' => 'string', + 'supported_services' => '\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices', + 'tool' => '\Flat\APIClient\Model\LtiConfiguration1p3BaseTool', + 'public_keyset_url' => 'string', + 'initiate_login_url' => 'string', + 'redirect_uris' => 'string[]', + 'enable_email_matching' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'mode' => null, + 'platform_iss' => null, + 'platform_name' => null, + 'client_id' => null, + 'deployment_id' => null, + 'access_token_url' => 'url', + 'authorization_url' => 'url', + 'jwks_url' => 'url', + 'deployment_mode' => null, + 'supported_services' => null, + 'tool' => null, + 'public_keyset_url' => null, + 'initiate_login_url' => null, + 'redirect_uris' => null, + 'enable_email_matching' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'mode' => false, + 'platform_iss' => false, + 'platform_name' => false, + 'client_id' => false, + 'deployment_id' => false, + 'access_token_url' => false, + 'authorization_url' => false, + 'jwks_url' => false, + 'deployment_mode' => false, + 'supported_services' => false, + 'tool' => false, + 'public_keyset_url' => false, + 'initiate_login_url' => false, + 'redirect_uris' => false, + 'enable_email_matching' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'mode' => 'mode', + 'platform_iss' => 'platformIss', + 'platform_name' => 'platformName', + 'client_id' => 'clientId', + 'deployment_id' => 'deploymentId', + 'access_token_url' => 'accessTokenUrl', + 'authorization_url' => 'authorizationUrl', + 'jwks_url' => 'jwksUrl', + 'deployment_mode' => 'deploymentMode', + 'supported_services' => 'supportedServices', + 'tool' => 'tool', + 'public_keyset_url' => 'publicKeysetUrl', + 'initiate_login_url' => 'initiateLoginUrl', + 'redirect_uris' => 'redirectUris', + 'enable_email_matching' => 'enableEmailMatching' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'mode' => 'setMode', + 'platform_iss' => 'setPlatformIss', + 'platform_name' => 'setPlatformName', + 'client_id' => 'setClientId', + 'deployment_id' => 'setDeploymentId', + 'access_token_url' => 'setAccessTokenUrl', + 'authorization_url' => 'setAuthorizationUrl', + 'jwks_url' => 'setJwksUrl', + 'deployment_mode' => 'setDeploymentMode', + 'supported_services' => 'setSupportedServices', + 'tool' => 'setTool', + 'public_keyset_url' => 'setPublicKeysetUrl', + 'initiate_login_url' => 'setInitiateLoginUrl', + 'redirect_uris' => 'setRedirectUris', + 'enable_email_matching' => 'setEnableEmailMatching' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'mode' => 'getMode', + 'platform_iss' => 'getPlatformIss', + 'platform_name' => 'getPlatformName', + 'client_id' => 'getClientId', + 'deployment_id' => 'getDeploymentId', + 'access_token_url' => 'getAccessTokenUrl', + 'authorization_url' => 'getAuthorizationUrl', + 'jwks_url' => 'getJwksUrl', + 'deployment_mode' => 'getDeploymentMode', + 'supported_services' => 'getSupportedServices', + 'tool' => 'getTool', + 'public_keyset_url' => 'getPublicKeysetUrl', + 'initiate_login_url' => 'getInitiateLoginUrl', + 'redirect_uris' => 'getRedirectUris', + 'enable_email_matching' => 'getEnableEmailMatching' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const MODE__1P3_MANUAL = '1p3-manual'; + public const MODE__1P3_DEPLOYMENT = '1p3-deployment'; + public const MODE__1P3_DYNAMIC = '1p3-dynamic'; + public const DEPLOYMENT_MODE_SINGLE = 'single'; + public const DEPLOYMENT_MODE_MULTI = 'multi'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getModeAllowableValues() + { + return [ + self::MODE__1P3_MANUAL, + self::MODE__1P3_DEPLOYMENT, + self::MODE__1P3_DYNAMIC, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getDeploymentModeAllowableValues() + { + return [ + self::DEPLOYMENT_MODE_SINGLE, + self::DEPLOYMENT_MODE_MULTI, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('mode', $data ?? [], null); + $this->setIfExists('platform_iss', $data ?? [], null); + $this->setIfExists('platform_name', $data ?? [], null); + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('deployment_id', $data ?? [], null); + $this->setIfExists('access_token_url', $data ?? [], null); + $this->setIfExists('authorization_url', $data ?? [], null); + $this->setIfExists('jwks_url', $data ?? [], null); + $this->setIfExists('deployment_mode', $data ?? [], null); + $this->setIfExists('supported_services', $data ?? [], null); + $this->setIfExists('tool', $data ?? [], null); + $this->setIfExists('public_keyset_url', $data ?? [], null); + $this->setIfExists('initiate_login_url', $data ?? [], null); + $this->setIfExists('redirect_uris', $data ?? [], null); + $this->setIfExists('enable_email_matching', $data ?? [], true); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = self::getModeAllowableValues(); + if (!is_null($this->container['mode']) && !in_array($this->container['mode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'mode', must be one of '%s'", + $this->container['mode'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = self::getDeploymentModeAllowableValues(); + if (!is_null($this->container['deployment_mode']) && !in_array($this->container['deployment_mode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'deployment_mode', must be one of '%s'", + $this->container['deployment_mode'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets mode + * + * @return string|null + */ + public function getMode(): ?string + { + return $this->container['mode']; + } + + /** + * Sets mode + * + * @param string|null $mode LTI 1.3 configuration mode + * + * @return $this + */ + public function setMode(?string $mode): static + { + if (is_null($mode)) { + throw new InvalidArgumentException('non-nullable mode cannot be null'); + } + $allowedValues = self::getModeAllowableValues(); + if (!in_array($mode, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'mode', must be one of '%s'", + $mode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['mode'] = $mode; + + return $this; + } + + /** + * Gets platform_iss + * + * @return string|null + */ + public function getPlatformIss(): ?string + { + return $this->container['platform_iss']; + } + + /** + * Sets platform_iss + * + * @param string|null $platform_iss Platform issuer URL + * + * @return $this + */ + public function setPlatformIss(?string $platform_iss): static + { + if (is_null($platform_iss)) { + throw new InvalidArgumentException('non-nullable platform_iss cannot be null'); + } + $this->container['platform_iss'] = $platform_iss; + + return $this; + } + + /** + * Gets platform_name + * + * @return string|null + */ + public function getPlatformName(): ?string + { + return $this->container['platform_name']; + } + + /** + * Sets platform_name + * + * @param string|null $platform_name Platform display name + * + * @return $this + */ + public function setPlatformName(?string $platform_name): static + { + if (is_null($platform_name)) { + throw new InvalidArgumentException('non-nullable platform_name cannot be null'); + } + $this->container['platform_name'] = $platform_name; + + return $this; + } + + /** + * Gets client_id + * + * @return string|null + */ + public function getClientId(): ?string + { + return $this->container['client_id']; + } + + /** + * Sets client_id + * + * @param string|null $client_id OAuth2 client_id allocated by the platform + * + * @return $this + */ + public function setClientId(?string $client_id): static + { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } + $this->container['client_id'] = $client_id; + + return $this; + } + + /** + * Gets deployment_id + * + * @return string|null + */ + public function getDeploymentId(): ?string + { + return $this->container['deployment_id']; + } + + /** + * Sets deployment_id + * + * @param string|null $deployment_id Deployment ID linking the tool to a tenant/class (varies by platform) + * + * @return $this + */ + public function setDeploymentId(?string $deployment_id): static + { + if (is_null($deployment_id)) { + throw new InvalidArgumentException('non-nullable deployment_id cannot be null'); + } + $this->container['deployment_id'] = $deployment_id; + + return $this; + } + + /** + * Gets access_token_url + * + * @return string|null + */ + public function getAccessTokenUrl(): ?string + { + return $this->container['access_token_url']; + } + + /** + * Sets access_token_url + * + * @param string|null $access_token_url OAuth2 token endpoint (for AGS/NRPS) + * + * @return $this + */ + public function setAccessTokenUrl(?string $access_token_url): static + { + if (is_null($access_token_url)) { + throw new InvalidArgumentException('non-nullable access_token_url cannot be null'); + } + $this->container['access_token_url'] = $access_token_url; + + return $this; + } + + /** + * Gets authorization_url + * + * @return string|null + */ + public function getAuthorizationUrl(): ?string + { + return $this->container['authorization_url']; + } + + /** + * Sets authorization_url + * + * @param string|null $authorization_url OIDC authorization/login endpoint + * + * @return $this + */ + public function setAuthorizationUrl(?string $authorization_url): static + { + if (is_null($authorization_url)) { + throw new InvalidArgumentException('non-nullable authorization_url cannot be null'); + } + $this->container['authorization_url'] = $authorization_url; + + return $this; + } + + /** + * Gets jwks_url + * + * @return string|null + */ + public function getJwksUrl(): ?string + { + return $this->container['jwks_url']; + } + + /** + * Sets jwks_url + * + * @param string|null $jwks_url Platform JWKS endpoint (public keys) + * + * @return $this + */ + public function setJwksUrl(?string $jwks_url): static + { + if (is_null($jwks_url)) { + throw new InvalidArgumentException('non-nullable jwks_url cannot be null'); + } + $this->container['jwks_url'] = $jwks_url; + + return $this; + } + + /** + * Gets deployment_mode + * + * @return string|null + */ + public function getDeploymentMode(): ?string + { + return $this->container['deployment_mode']; + } + + /** + * Sets deployment_mode + * + * @param string|null $deployment_mode Deployment mode (single for organization-specific, multi for shared parent platforms) + * + * @return $this + */ + public function setDeploymentMode(?string $deployment_mode): static + { + if (is_null($deployment_mode)) { + throw new InvalidArgumentException('non-nullable deployment_mode cannot be null'); + } + $allowedValues = self::getDeploymentModeAllowableValues(); + if (!in_array($deployment_mode, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'deployment_mode', must be one of '%s'", + $deployment_mode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['deployment_mode'] = $deployment_mode; + + return $this; + } + + /** + * Gets supported_services + * + * @return \Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices|null + */ + public function getSupportedServices(): ?\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices + { + return $this->container['supported_services']; + } + + /** + * Sets supported_services + * + * @param \Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices|null $supported_services supported_services + * + * @return $this + */ + public function setSupportedServices(?\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices $supported_services): static + { + if (is_null($supported_services)) { + throw new InvalidArgumentException('non-nullable supported_services cannot be null'); + } + $this->container['supported_services'] = $supported_services; + + return $this; + } + + /** + * Gets tool + * + * @return \Flat\APIClient\Model\LtiConfiguration1p3BaseTool|null + */ + public function getTool(): ?\Flat\APIClient\Model\LtiConfiguration1p3BaseTool + { + return $this->container['tool']; + } + + /** + * Sets tool + * + * @param \Flat\APIClient\Model\LtiConfiguration1p3BaseTool|null $tool tool + * + * @return $this + */ + public function setTool(?\Flat\APIClient\Model\LtiConfiguration1p3BaseTool $tool): static + { + if (is_null($tool)) { + throw new InvalidArgumentException('non-nullable tool cannot be null'); + } + $this->container['tool'] = $tool; + + return $this; + } + + /** + * Gets public_keyset_url + * + * @return string|null + */ + public function getPublicKeysetUrl(): ?string + { + return $this->container['public_keyset_url']; + } + + /** + * Sets public_keyset_url + * + * @param string|null $public_keyset_url Public keyset URL for the platform to retrieve Flat's public keys + * + * @return $this + */ + public function setPublicKeysetUrl(?string $public_keyset_url): static + { + if (is_null($public_keyset_url)) { + throw new InvalidArgumentException('non-nullable public_keyset_url cannot be null'); + } + $this->container['public_keyset_url'] = $public_keyset_url; + + return $this; + } + + /** + * Gets initiate_login_url + * + * @return string|null + */ + public function getInitiateLoginUrl(): ?string + { + return $this->container['initiate_login_url']; + } + + /** + * Sets initiate_login_url + * + * @param string|null $initiate_login_url URL for the platform to initiate LTI login + * + * @return $this + */ + public function setInitiateLoginUrl(?string $initiate_login_url): static + { + if (is_null($initiate_login_url)) { + throw new InvalidArgumentException('non-nullable initiate_login_url cannot be null'); + } + $this->container['initiate_login_url'] = $initiate_login_url; + + return $this; + } + + /** + * Gets redirect_uris + * + * @return string[]|null + */ + public function getRedirectUris(): ?array + { + return $this->container['redirect_uris']; + } + + /** + * Sets redirect_uris + * + * @param string[]|null $redirect_uris Allowed redirect URIs for LTI launches + * + * @return $this + */ + public function setRedirectUris(?array $redirect_uris): static + { + if (is_null($redirect_uris)) { + throw new InvalidArgumentException('non-nullable redirect_uris cannot be null'); + } + $this->container['redirect_uris'] = $redirect_uris; + + return $this; + } + + /** + * Gets enable_email_matching + * + * @return bool|null + */ + public function getEnableEmailMatching(): ?bool + { + return $this->container['enable_email_matching']; + } + + /** + * Sets enable_email_matching + * + * @param bool|null $enable_email_matching Enable email-based user matching during LTI authentication. When true (default): If a user with the same email exists in the organization, they will be matched and logged in instead of creating a new account. When false: Email matching is disabled. Only LTI ID matching is used, which means multiple LTI users can share the same email address and have separate Flat accounts. This is useful for cases like siblings sharing a parent email in the LMS. + * + * @return $this + */ + public function setEnableEmailMatching(?bool $enable_email_matching): static + { + if (is_null($enable_email_matching)) { + throw new InvalidArgumentException('non-nullable enable_email_matching cannot be null'); + } + $this->container['enable_email_matching'] = $enable_email_matching; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LtiConfiguration1p3BaseSupportedServices.php b/src/Model/LtiConfiguration1p3BaseSupportedServices.php new file mode 100644 index 0000000..c35a7fc --- /dev/null +++ b/src/Model/LtiConfiguration1p3BaseSupportedServices.php @@ -0,0 +1,453 @@ + + */ +class LtiConfiguration1p3BaseSupportedServices implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'LtiConfiguration1p3Base_supportedServices'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'ags' => '\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServicesAgs', + 'nrps' => '\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServicesNrps', + 'deep_linking' => '\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServicesDeepLinking' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'ags' => null, + 'nrps' => null, + 'deep_linking' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'ags' => false, + 'nrps' => false, + 'deep_linking' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'ags' => 'ags', + 'nrps' => 'nrps', + 'deep_linking' => 'deepLinking' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'ags' => 'setAgs', + 'nrps' => 'setNrps', + 'deep_linking' => 'setDeepLinking' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'ags' => 'getAgs', + 'nrps' => 'getNrps', + 'deep_linking' => 'getDeepLinking' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('ags', $data ?? [], null); + $this->setIfExists('nrps', $data ?? [], null); + $this->setIfExists('deep_linking', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets ags + * + * @return \Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServicesAgs|null + */ + public function getAgs(): ?\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServicesAgs + { + return $this->container['ags']; + } + + /** + * Sets ags + * + * @param \Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServicesAgs|null $ags ags + * + * @return $this + */ + public function setAgs(?\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServicesAgs $ags): static + { + if (is_null($ags)) { + throw new InvalidArgumentException('non-nullable ags cannot be null'); + } + $this->container['ags'] = $ags; + + return $this; + } + + /** + * Gets nrps + * + * @return \Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServicesNrps|null + */ + public function getNrps(): ?\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServicesNrps + { + return $this->container['nrps']; + } + + /** + * Sets nrps + * + * @param \Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServicesNrps|null $nrps nrps + * + * @return $this + */ + public function setNrps(?\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServicesNrps $nrps): static + { + if (is_null($nrps)) { + throw new InvalidArgumentException('non-nullable nrps cannot be null'); + } + $this->container['nrps'] = $nrps; + + return $this; + } + + /** + * Gets deep_linking + * + * @return \Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServicesDeepLinking|null + */ + public function getDeepLinking(): ?\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServicesDeepLinking + { + return $this->container['deep_linking']; + } + + /** + * Sets deep_linking + * + * @param \Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServicesDeepLinking|null $deep_linking deep_linking + * + * @return $this + */ + public function setDeepLinking(?\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServicesDeepLinking $deep_linking): static + { + if (is_null($deep_linking)) { + throw new InvalidArgumentException('non-nullable deep_linking cannot be null'); + } + $this->container['deep_linking'] = $deep_linking; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LtiConfiguration1p3BaseSupportedServicesAgs.php b/src/Model/LtiConfiguration1p3BaseSupportedServicesAgs.php new file mode 100644 index 0000000..015eaa6 --- /dev/null +++ b/src/Model/LtiConfiguration1p3BaseSupportedServicesAgs.php @@ -0,0 +1,487 @@ + + */ +class LtiConfiguration1p3BaseSupportedServicesAgs implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'LtiConfiguration1p3Base_supportedServices_ags'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'available' => 'bool', + 'version' => 'string', + 'enabled' => 'bool', + 'lineitems_url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'available' => null, + 'version' => null, + 'enabled' => null, + 'lineitems_url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'available' => false, + 'version' => false, + 'enabled' => false, + 'lineitems_url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'available' => 'available', + 'version' => 'version', + 'enabled' => 'enabled', + 'lineitems_url' => 'lineitemsUrl' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'available' => 'setAvailable', + 'version' => 'setVersion', + 'enabled' => 'setEnabled', + 'lineitems_url' => 'setLineitemsUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'available' => 'getAvailable', + 'version' => 'getVersion', + 'enabled' => 'getEnabled', + 'lineitems_url' => 'getLineitemsUrl' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('available', $data ?? [], null); + $this->setIfExists('version', $data ?? [], null); + $this->setIfExists('enabled', $data ?? [], null); + $this->setIfExists('lineitems_url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets available + * + * @return bool|null + */ + public function getAvailable(): ?bool + { + return $this->container['available']; + } + + /** + * Sets available + * + * @param bool|null $available Whether AGS claims were detected in launches from this platform + * + * @return $this + */ + public function setAvailable(?bool $available): static + { + if (is_null($available)) { + throw new InvalidArgumentException('non-nullable available cannot be null'); + } + $this->container['available'] = $available; + + return $this; + } + + /** + * Gets version + * + * @return string|null + */ + public function getVersion(): ?string + { + return $this->container['version']; + } + + /** + * Sets version + * + * @param string|null $version AGS version supported (e.g., \"2.0\") + * + * @return $this + */ + public function setVersion(?string $version): static + { + if (is_null($version)) { + throw new InvalidArgumentException('non-nullable version cannot be null'); + } + $this->container['version'] = $version; + + return $this; + } + + /** + * Gets enabled + * + * @return bool|null + */ + public function getEnabled(): ?bool + { + return $this->container['enabled']; + } + + /** + * Sets enabled + * + * @param bool|null $enabled Whether we have AGS enabled for this platform + * + * @return $this + */ + public function setEnabled(?bool $enabled): static + { + if (is_null($enabled)) { + throw new InvalidArgumentException('non-nullable enabled cannot be null'); + } + $this->container['enabled'] = $enabled; + + return $this; + } + + /** + * Gets lineitems_url + * + * @return string|null + */ + public function getLineitemsUrl(): ?string + { + return $this->container['lineitems_url']; + } + + /** + * Sets lineitems_url + * + * @param string|null $lineitems_url Base URL for line items operations as provided by the platform + * + * @return $this + */ + public function setLineitemsUrl(?string $lineitems_url): static + { + if (is_null($lineitems_url)) { + throw new InvalidArgumentException('non-nullable lineitems_url cannot be null'); + } + $this->container['lineitems_url'] = $lineitems_url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LtiConfiguration1p3BaseSupportedServicesDeepLinking.php b/src/Model/LtiConfiguration1p3BaseSupportedServicesDeepLinking.php new file mode 100644 index 0000000..dac549c --- /dev/null +++ b/src/Model/LtiConfiguration1p3BaseSupportedServicesDeepLinking.php @@ -0,0 +1,419 @@ + + */ +class LtiConfiguration1p3BaseSupportedServicesDeepLinking implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'LtiConfiguration1p3Base_supportedServices_deepLinking'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'available' => 'bool', + 'version' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'available' => null, + 'version' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'available' => false, + 'version' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'available' => 'available', + 'version' => 'version' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'available' => 'setAvailable', + 'version' => 'setVersion' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'available' => 'getAvailable', + 'version' => 'getVersion' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('available', $data ?? [], null); + $this->setIfExists('version', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets available + * + * @return bool|null + */ + public function getAvailable(): ?bool + { + return $this->container['available']; + } + + /** + * Sets available + * + * @param bool|null $available Whether Deep Linking claims were detected in launches from this platform + * + * @return $this + */ + public function setAvailable(?bool $available): static + { + if (is_null($available)) { + throw new InvalidArgumentException('non-nullable available cannot be null'); + } + $this->container['available'] = $available; + + return $this; + } + + /** + * Gets version + * + * @return string|null + */ + public function getVersion(): ?string + { + return $this->container['version']; + } + + /** + * Sets version + * + * @param string|null $version Deep Linking version supported (e.g., \"2.0\") + * + * @return $this + */ + public function setVersion(?string $version): static + { + if (is_null($version)) { + throw new InvalidArgumentException('non-nullable version cannot be null'); + } + $this->container['version'] = $version; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LtiConfiguration1p3BaseSupportedServicesNrps.php b/src/Model/LtiConfiguration1p3BaseSupportedServicesNrps.php new file mode 100644 index 0000000..6683fb3 --- /dev/null +++ b/src/Model/LtiConfiguration1p3BaseSupportedServicesNrps.php @@ -0,0 +1,453 @@ + + */ +class LtiConfiguration1p3BaseSupportedServicesNrps implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'LtiConfiguration1p3Base_supportedServices_nrps'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'available' => 'bool', + 'version' => 'string', + 'enabled' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'available' => null, + 'version' => null, + 'enabled' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'available' => false, + 'version' => false, + 'enabled' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'available' => 'available', + 'version' => 'version', + 'enabled' => 'enabled' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'available' => 'setAvailable', + 'version' => 'setVersion', + 'enabled' => 'setEnabled' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'available' => 'getAvailable', + 'version' => 'getVersion', + 'enabled' => 'getEnabled' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('available', $data ?? [], null); + $this->setIfExists('version', $data ?? [], null); + $this->setIfExists('enabled', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets available + * + * @return bool|null + */ + public function getAvailable(): ?bool + { + return $this->container['available']; + } + + /** + * Sets available + * + * @param bool|null $available Whether NRPS claims were detected in launches from this platform + * + * @return $this + */ + public function setAvailable(?bool $available): static + { + if (is_null($available)) { + throw new InvalidArgumentException('non-nullable available cannot be null'); + } + $this->container['available'] = $available; + + return $this; + } + + /** + * Gets version + * + * @return string|null + */ + public function getVersion(): ?string + { + return $this->container['version']; + } + + /** + * Sets version + * + * @param string|null $version NRPS version supported (e.g., \"2.0\") + * + * @return $this + */ + public function setVersion(?string $version): static + { + if (is_null($version)) { + throw new InvalidArgumentException('non-nullable version cannot be null'); + } + $this->container['version'] = $version; + + return $this; + } + + /** + * Gets enabled + * + * @return bool|null + */ + public function getEnabled(): ?bool + { + return $this->container['enabled']; + } + + /** + * Sets enabled + * + * @param bool|null $enabled Whether we have NRPS enabled for this platform + * + * @return $this + */ + public function setEnabled(?bool $enabled): static + { + if (is_null($enabled)) { + throw new InvalidArgumentException('non-nullable enabled cannot be null'); + } + $this->container['enabled'] = $enabled; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LtiConfiguration1p3BaseTool.php b/src/Model/LtiConfiguration1p3BaseTool.php new file mode 100644 index 0000000..a0c3193 --- /dev/null +++ b/src/Model/LtiConfiguration1p3BaseTool.php @@ -0,0 +1,555 @@ + + */ +class LtiConfiguration1p3BaseTool implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'LtiConfiguration1p3Base_tool'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'product' => 'string', + 'version' => 'string', + 'instance_name' => 'string', + 'instance_guid' => 'string', + 'instance_contact' => 'string', + 'instance_domain' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'product' => null, + 'version' => null, + 'instance_name' => null, + 'instance_guid' => null, + 'instance_contact' => null, + 'instance_domain' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'product' => false, + 'version' => false, + 'instance_name' => false, + 'instance_guid' => false, + 'instance_contact' => false, + 'instance_domain' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'product' => 'product', + 'version' => 'version', + 'instance_name' => 'instanceName', + 'instance_guid' => 'instanceGuid', + 'instance_contact' => 'instanceContact', + 'instance_domain' => 'instanceDomain' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'product' => 'setProduct', + 'version' => 'setVersion', + 'instance_name' => 'setInstanceName', + 'instance_guid' => 'setInstanceGuid', + 'instance_contact' => 'setInstanceContact', + 'instance_domain' => 'setInstanceDomain' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'product' => 'getProduct', + 'version' => 'getVersion', + 'instance_name' => 'getInstanceName', + 'instance_guid' => 'getInstanceGuid', + 'instance_contact' => 'getInstanceContact', + 'instance_domain' => 'getInstanceDomain' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('product', $data ?? [], null); + $this->setIfExists('version', $data ?? [], null); + $this->setIfExists('instance_name', $data ?? [], null); + $this->setIfExists('instance_guid', $data ?? [], null); + $this->setIfExists('instance_contact', $data ?? [], null); + $this->setIfExists('instance_domain', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets product + * + * @return string|null + */ + public function getProduct(): ?string + { + return $this->container['product']; + } + + /** + * Sets product + * + * @param string|null $product Product family code (e.g., canvas, moodle, schoology) + * + * @return $this + */ + public function setProduct(?string $product): static + { + if (is_null($product)) { + throw new InvalidArgumentException('non-nullable product cannot be null'); + } + $this->container['product'] = $product; + + return $this; + } + + /** + * Gets version + * + * @return string|null + */ + public function getVersion(): ?string + { + return $this->container['version']; + } + + /** + * Sets version + * + * @param string|null $version Platform version string + * + * @return $this + */ + public function setVersion(?string $version): static + { + if (is_null($version)) { + throw new InvalidArgumentException('non-nullable version cannot be null'); + } + $this->container['version'] = $version; + + return $this; + } + + /** + * Gets instance_name + * + * @return string|null + */ + public function getInstanceName(): ?string + { + return $this->container['instance_name']; + } + + /** + * Sets instance_name + * + * @param string|null $instance_name Instance name (e.g., 'My University Canvas') + * + * @return $this + */ + public function setInstanceName(?string $instance_name): static + { + if (is_null($instance_name)) { + throw new InvalidArgumentException('non-nullable instance_name cannot be null'); + } + $this->container['instance_name'] = $instance_name; + + return $this; + } + + /** + * Gets instance_guid + * + * @return string|null + */ + public function getInstanceGuid(): ?string + { + return $this->container['instance_guid']; + } + + /** + * Sets instance_guid + * + * @param string|null $instance_guid Unique instance identifier + * + * @return $this + */ + public function setInstanceGuid(?string $instance_guid): static + { + if (is_null($instance_guid)) { + throw new InvalidArgumentException('non-nullable instance_guid cannot be null'); + } + $this->container['instance_guid'] = $instance_guid; + + return $this; + } + + /** + * Gets instance_contact + * + * @return string|null + */ + public function getInstanceContact(): ?string + { + return $this->container['instance_contact']; + } + + /** + * Sets instance_contact + * + * @param string|null $instance_contact Contact email or handle for the instance + * + * @return $this + */ + public function setInstanceContact(?string $instance_contact): static + { + if (is_null($instance_contact)) { + throw new InvalidArgumentException('non-nullable instance_contact cannot be null'); + } + $this->container['instance_contact'] = $instance_contact; + + return $this; + } + + /** + * Gets instance_domain + * + * @return string|null + */ + public function getInstanceDomain(): ?string + { + return $this->container['instance_domain']; + } + + /** + * Sets instance_domain + * + * @param string|null $instance_domain Instance root domain + * + * @return $this + */ + public function setInstanceDomain(?string $instance_domain): static + { + if (is_null($instance_domain)) { + throw new InvalidArgumentException('non-nullable instance_domain cannot be null'); + } + $this->container['instance_domain'] = $instance_domain; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LtiConfiguration1p3Deployment.php b/src/Model/LtiConfiguration1p3Deployment.php new file mode 100644 index 0000000..3383f39 --- /dev/null +++ b/src/Model/LtiConfiguration1p3Deployment.php @@ -0,0 +1,1411 @@ + + */ +class LtiConfiguration1p3Deployment implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'LtiConfiguration1p3Deployment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'lti_version' => 'string', + 'organization_id' => 'string', + 'organization_name' => 'string', + 'creator_id' => 'string', + 'creation_date' => '\DateTime', + 'last_used_date' => '\DateTime', + 'status' => 'string', + 'mode' => 'string', + 'platform_iss' => 'string', + 'platform_name' => 'string', + 'client_id' => 'string', + 'deployment_id' => 'string', + 'access_token_url' => 'string', + 'authorization_url' => 'string', + 'jwks_url' => 'string', + 'deployment_mode' => 'string', + 'supported_services' => '\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices', + 'tool' => '\Flat\APIClient\Model\LtiConfiguration1p3BaseTool', + 'public_keyset_url' => 'string', + 'initiate_login_url' => 'string', + 'redirect_uris' => 'string[]', + 'enable_email_matching' => 'bool', + 'parent_id' => 'string', + 'deployment_key' => 'string', + 'deployment_breakdown_by' => 'string', + 'deployment_breakdown_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'lti_version' => null, + 'organization_id' => null, + 'organization_name' => null, + 'creator_id' => null, + 'creation_date' => 'date-time', + 'last_used_date' => 'date-time', + 'status' => null, + 'mode' => null, + 'platform_iss' => null, + 'platform_name' => null, + 'client_id' => null, + 'deployment_id' => null, + 'access_token_url' => 'url', + 'authorization_url' => 'url', + 'jwks_url' => 'url', + 'deployment_mode' => null, + 'supported_services' => null, + 'tool' => null, + 'public_keyset_url' => null, + 'initiate_login_url' => null, + 'redirect_uris' => null, + 'enable_email_matching' => null, + 'parent_id' => null, + 'deployment_key' => null, + 'deployment_breakdown_by' => null, + 'deployment_breakdown_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'lti_version' => false, + 'organization_id' => false, + 'organization_name' => false, + 'creator_id' => false, + 'creation_date' => false, + 'last_used_date' => false, + 'status' => false, + 'mode' => false, + 'platform_iss' => false, + 'platform_name' => false, + 'client_id' => false, + 'deployment_id' => false, + 'access_token_url' => false, + 'authorization_url' => false, + 'jwks_url' => false, + 'deployment_mode' => false, + 'supported_services' => false, + 'tool' => false, + 'public_keyset_url' => false, + 'initiate_login_url' => false, + 'redirect_uris' => false, + 'enable_email_matching' => false, + 'parent_id' => false, + 'deployment_key' => false, + 'deployment_breakdown_by' => false, + 'deployment_breakdown_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'lti_version' => 'ltiVersion', + 'organization_id' => 'organizationId', + 'organization_name' => 'organizationName', + 'creator_id' => 'creatorId', + 'creation_date' => 'creationDate', + 'last_used_date' => 'lastUsedDate', + 'status' => 'status', + 'mode' => 'mode', + 'platform_iss' => 'platformIss', + 'platform_name' => 'platformName', + 'client_id' => 'clientId', + 'deployment_id' => 'deploymentId', + 'access_token_url' => 'accessTokenUrl', + 'authorization_url' => 'authorizationUrl', + 'jwks_url' => 'jwksUrl', + 'deployment_mode' => 'deploymentMode', + 'supported_services' => 'supportedServices', + 'tool' => 'tool', + 'public_keyset_url' => 'publicKeysetUrl', + 'initiate_login_url' => 'initiateLoginUrl', + 'redirect_uris' => 'redirectUris', + 'enable_email_matching' => 'enableEmailMatching', + 'parent_id' => 'parentId', + 'deployment_key' => 'deploymentKey', + 'deployment_breakdown_by' => 'deploymentBreakdownBy', + 'deployment_breakdown_id' => 'deploymentBreakdownId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'lti_version' => 'setLtiVersion', + 'organization_id' => 'setOrganizationId', + 'organization_name' => 'setOrganizationName', + 'creator_id' => 'setCreatorId', + 'creation_date' => 'setCreationDate', + 'last_used_date' => 'setLastUsedDate', + 'status' => 'setStatus', + 'mode' => 'setMode', + 'platform_iss' => 'setPlatformIss', + 'platform_name' => 'setPlatformName', + 'client_id' => 'setClientId', + 'deployment_id' => 'setDeploymentId', + 'access_token_url' => 'setAccessTokenUrl', + 'authorization_url' => 'setAuthorizationUrl', + 'jwks_url' => 'setJwksUrl', + 'deployment_mode' => 'setDeploymentMode', + 'supported_services' => 'setSupportedServices', + 'tool' => 'setTool', + 'public_keyset_url' => 'setPublicKeysetUrl', + 'initiate_login_url' => 'setInitiateLoginUrl', + 'redirect_uris' => 'setRedirectUris', + 'enable_email_matching' => 'setEnableEmailMatching', + 'parent_id' => 'setParentId', + 'deployment_key' => 'setDeploymentKey', + 'deployment_breakdown_by' => 'setDeploymentBreakdownBy', + 'deployment_breakdown_id' => 'setDeploymentBreakdownId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'lti_version' => 'getLtiVersion', + 'organization_id' => 'getOrganizationId', + 'organization_name' => 'getOrganizationName', + 'creator_id' => 'getCreatorId', + 'creation_date' => 'getCreationDate', + 'last_used_date' => 'getLastUsedDate', + 'status' => 'getStatus', + 'mode' => 'getMode', + 'platform_iss' => 'getPlatformIss', + 'platform_name' => 'getPlatformName', + 'client_id' => 'getClientId', + 'deployment_id' => 'getDeploymentId', + 'access_token_url' => 'getAccessTokenUrl', + 'authorization_url' => 'getAuthorizationUrl', + 'jwks_url' => 'getJwksUrl', + 'deployment_mode' => 'getDeploymentMode', + 'supported_services' => 'getSupportedServices', + 'tool' => 'getTool', + 'public_keyset_url' => 'getPublicKeysetUrl', + 'initiate_login_url' => 'getInitiateLoginUrl', + 'redirect_uris' => 'getRedirectUris', + 'enable_email_matching' => 'getEnableEmailMatching', + 'parent_id' => 'getParentId', + 'deployment_key' => 'getDeploymentKey', + 'deployment_breakdown_by' => 'getDeploymentBreakdownBy', + 'deployment_breakdown_id' => 'getDeploymentBreakdownId' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const LTI_VERSION__1P3 = '1p3'; + public const STATUS_READY_TO_USE = 'ready-to-use'; + public const STATUS_IN_USE = 'in-use'; + public const STATUS_INCOMPLETE_SETUP = 'incomplete-setup'; + public const MODE__1P3_DEPLOYMENT = '1p3-deployment'; + public const DEPLOYMENT_MODE_SINGLE = 'single'; + public const DEPLOYMENT_MODE_MULTI = 'multi'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getLtiVersionAllowableValues() + { + return [ + self::LTI_VERSION__1P3, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getStatusAllowableValues() + { + return [ + self::STATUS_READY_TO_USE, + self::STATUS_IN_USE, + self::STATUS_INCOMPLETE_SETUP, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getModeAllowableValues() + { + return [ + self::MODE__1P3_DEPLOYMENT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getDeploymentModeAllowableValues() + { + return [ + self::DEPLOYMENT_MODE_SINGLE, + self::DEPLOYMENT_MODE_MULTI, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('lti_version', $data ?? [], null); + $this->setIfExists('organization_id', $data ?? [], null); + $this->setIfExists('organization_name', $data ?? [], null); + $this->setIfExists('creator_id', $data ?? [], null); + $this->setIfExists('creation_date', $data ?? [], null); + $this->setIfExists('last_used_date', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('mode', $data ?? [], null); + $this->setIfExists('platform_iss', $data ?? [], null); + $this->setIfExists('platform_name', $data ?? [], null); + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('deployment_id', $data ?? [], null); + $this->setIfExists('access_token_url', $data ?? [], null); + $this->setIfExists('authorization_url', $data ?? [], null); + $this->setIfExists('jwks_url', $data ?? [], null); + $this->setIfExists('deployment_mode', $data ?? [], null); + $this->setIfExists('supported_services', $data ?? [], null); + $this->setIfExists('tool', $data ?? [], null); + $this->setIfExists('public_keyset_url', $data ?? [], null); + $this->setIfExists('initiate_login_url', $data ?? [], null); + $this->setIfExists('redirect_uris', $data ?? [], null); + $this->setIfExists('enable_email_matching', $data ?? [], true); + $this->setIfExists('parent_id', $data ?? [], null); + $this->setIfExists('deployment_key', $data ?? [], null); + $this->setIfExists('deployment_breakdown_by', $data ?? [], null); + $this->setIfExists('deployment_breakdown_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['lti_version'] === null) { + $invalidProperties[] = "'lti_version' can't be null"; + } + $allowedValues = self::getLtiVersionAllowableValues(); + if (!is_null($this->container['lti_version']) && !in_array($this->container['lti_version'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'lti_version', must be one of '%s'", + $this->container['lti_version'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['creation_date'] === null) { + $invalidProperties[] = "'creation_date' can't be null"; + } + $allowedValues = self::getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = self::getModeAllowableValues(); + if (!is_null($this->container['mode']) && !in_array($this->container['mode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'mode', must be one of '%s'", + $this->container['mode'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = self::getDeploymentModeAllowableValues(); + if (!is_null($this->container['deployment_mode']) && !in_array($this->container['deployment_mode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'deployment_mode', must be one of '%s'", + $this->container['deployment_mode'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Configuration ID + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets lti_version + * + * @return string + */ + public function getLtiVersion(): string + { + return $this->container['lti_version']; + } + + /** + * Sets lti_version + * + * @param string $lti_version LTI version (1.3) + * + * @return $this + */ + public function setLtiVersion(string $lti_version): static + { + if (is_null($lti_version)) { + throw new InvalidArgumentException('non-nullable lti_version cannot be null'); + } + $allowedValues = self::getLtiVersionAllowableValues(); + if (!in_array($lti_version, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'lti_version', must be one of '%s'", + $lti_version, + implode("', '", $allowedValues) + ) + ); + } + $this->container['lti_version'] = $lti_version; + + return $this; + } + + /** + * Gets organization_id + * + * @return string|null + */ + public function getOrganizationId(): ?string + { + return $this->container['organization_id']; + } + + /** + * Sets organization_id + * + * @param string|null $organization_id Organization ID + * + * @return $this + */ + public function setOrganizationId(?string $organization_id): static + { + if (is_null($organization_id)) { + throw new InvalidArgumentException('non-nullable organization_id cannot be null'); + } + $this->container['organization_id'] = $organization_id; + + return $this; + } + + /** + * Gets organization_name + * + * @return string|null + */ + public function getOrganizationName(): ?string + { + return $this->container['organization_name']; + } + + /** + * Sets organization_name + * + * @param string|null $organization_name Organization name + * + * @return $this + */ + public function setOrganizationName(?string $organization_name): static + { + if (is_null($organization_name)) { + throw new InvalidArgumentException('non-nullable organization_name cannot be null'); + } + $this->container['organization_name'] = $organization_name; + + return $this; + } + + /** + * Gets creator_id + * + * @return string|null + */ + public function getCreatorId(): ?string + { + return $this->container['creator_id']; + } + + /** + * Sets creator_id + * + * @param string|null $creator_id ID of the user who created this configuration + * + * @return $this + */ + public function setCreatorId(?string $creator_id): static + { + if (is_null($creator_id)) { + throw new InvalidArgumentException('non-nullable creator_id cannot be null'); + } + $this->container['creator_id'] = $creator_id; + + return $this; + } + + /** + * Gets creation_date + * + * @return \DateTime + */ + public function getCreationDate(): \DateTime + { + return $this->container['creation_date']; + } + + /** + * Sets creation_date + * + * @param \DateTime $creation_date Configuration creation date + * + * @return $this + */ + public function setCreationDate(\DateTime $creation_date): static + { + if (is_null($creation_date)) { + throw new InvalidArgumentException('non-nullable creation_date cannot be null'); + } + $this->container['creation_date'] = $creation_date; + + return $this; + } + + /** + * Gets last_used_date + * + * @return \DateTime|null + */ + public function getLastUsedDate(): ?\DateTime + { + return $this->container['last_used_date']; + } + + /** + * Sets last_used_date + * + * @param \DateTime|null $last_used_date Last time this configuration was used + * + * @return $this + */ + public function setLastUsedDate(?\DateTime $last_used_date): static + { + if (is_null($last_used_date)) { + throw new InvalidArgumentException('non-nullable last_used_date cannot be null'); + } + $this->container['last_used_date'] = $last_used_date; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus(): ?string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Configuration status indicator + * + * @return $this + */ + public function setStatus(?string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = self::getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets mode + * + * @return string|null + */ + public function getMode(): ?string + { + return $this->container['mode']; + } + + /** + * Sets mode + * + * @param string|null $mode Deployment-based LTI 1.3 configuration mode + * + * @return $this + */ + public function setMode(?string $mode): static + { + if (is_null($mode)) { + throw new InvalidArgumentException('non-nullable mode cannot be null'); + } + $allowedValues = self::getModeAllowableValues(); + if (!in_array($mode, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'mode', must be one of '%s'", + $mode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['mode'] = $mode; + + return $this; + } + + /** + * Gets platform_iss + * + * @return string|null + */ + public function getPlatformIss(): ?string + { + return $this->container['platform_iss']; + } + + /** + * Sets platform_iss + * + * @param string|null $platform_iss Platform issuer URL + * + * @return $this + */ + public function setPlatformIss(?string $platform_iss): static + { + if (is_null($platform_iss)) { + throw new InvalidArgumentException('non-nullable platform_iss cannot be null'); + } + $this->container['platform_iss'] = $platform_iss; + + return $this; + } + + /** + * Gets platform_name + * + * @return string|null + */ + public function getPlatformName(): ?string + { + return $this->container['platform_name']; + } + + /** + * Sets platform_name + * + * @param string|null $platform_name Platform display name + * + * @return $this + */ + public function setPlatformName(?string $platform_name): static + { + if (is_null($platform_name)) { + throw new InvalidArgumentException('non-nullable platform_name cannot be null'); + } + $this->container['platform_name'] = $platform_name; + + return $this; + } + + /** + * Gets client_id + * + * @return string|null + */ + public function getClientId(): ?string + { + return $this->container['client_id']; + } + + /** + * Sets client_id + * + * @param string|null $client_id OAuth2 client_id allocated by the platform + * + * @return $this + */ + public function setClientId(?string $client_id): static + { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } + $this->container['client_id'] = $client_id; + + return $this; + } + + /** + * Gets deployment_id + * + * @return string|null + */ + public function getDeploymentId(): ?string + { + return $this->container['deployment_id']; + } + + /** + * Sets deployment_id + * + * @param string|null $deployment_id Deployment ID linking the tool to a tenant/class (varies by platform) + * + * @return $this + */ + public function setDeploymentId(?string $deployment_id): static + { + if (is_null($deployment_id)) { + throw new InvalidArgumentException('non-nullable deployment_id cannot be null'); + } + $this->container['deployment_id'] = $deployment_id; + + return $this; + } + + /** + * Gets access_token_url + * + * @return string|null + */ + public function getAccessTokenUrl(): ?string + { + return $this->container['access_token_url']; + } + + /** + * Sets access_token_url + * + * @param string|null $access_token_url OAuth2 token endpoint (for AGS/NRPS) + * + * @return $this + */ + public function setAccessTokenUrl(?string $access_token_url): static + { + if (is_null($access_token_url)) { + throw new InvalidArgumentException('non-nullable access_token_url cannot be null'); + } + $this->container['access_token_url'] = $access_token_url; + + return $this; + } + + /** + * Gets authorization_url + * + * @return string|null + */ + public function getAuthorizationUrl(): ?string + { + return $this->container['authorization_url']; + } + + /** + * Sets authorization_url + * + * @param string|null $authorization_url OIDC authorization/login endpoint + * + * @return $this + */ + public function setAuthorizationUrl(?string $authorization_url): static + { + if (is_null($authorization_url)) { + throw new InvalidArgumentException('non-nullable authorization_url cannot be null'); + } + $this->container['authorization_url'] = $authorization_url; + + return $this; + } + + /** + * Gets jwks_url + * + * @return string|null + */ + public function getJwksUrl(): ?string + { + return $this->container['jwks_url']; + } + + /** + * Sets jwks_url + * + * @param string|null $jwks_url Platform JWKS endpoint (public keys) + * + * @return $this + */ + public function setJwksUrl(?string $jwks_url): static + { + if (is_null($jwks_url)) { + throw new InvalidArgumentException('non-nullable jwks_url cannot be null'); + } + $this->container['jwks_url'] = $jwks_url; + + return $this; + } + + /** + * Gets deployment_mode + * + * @return string|null + */ + public function getDeploymentMode(): ?string + { + return $this->container['deployment_mode']; + } + + /** + * Sets deployment_mode + * + * @param string|null $deployment_mode Deployment mode (single for organization-specific, multi for shared parent platforms) + * + * @return $this + */ + public function setDeploymentMode(?string $deployment_mode): static + { + if (is_null($deployment_mode)) { + throw new InvalidArgumentException('non-nullable deployment_mode cannot be null'); + } + $allowedValues = self::getDeploymentModeAllowableValues(); + if (!in_array($deployment_mode, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'deployment_mode', must be one of '%s'", + $deployment_mode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['deployment_mode'] = $deployment_mode; + + return $this; + } + + /** + * Gets supported_services + * + * @return \Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices|null + */ + public function getSupportedServices(): ?\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices + { + return $this->container['supported_services']; + } + + /** + * Sets supported_services + * + * @param \Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices|null $supported_services supported_services + * + * @return $this + */ + public function setSupportedServices(?\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices $supported_services): static + { + if (is_null($supported_services)) { + throw new InvalidArgumentException('non-nullable supported_services cannot be null'); + } + $this->container['supported_services'] = $supported_services; + + return $this; + } + + /** + * Gets tool + * + * @return \Flat\APIClient\Model\LtiConfiguration1p3BaseTool|null + */ + public function getTool(): ?\Flat\APIClient\Model\LtiConfiguration1p3BaseTool + { + return $this->container['tool']; + } + + /** + * Sets tool + * + * @param \Flat\APIClient\Model\LtiConfiguration1p3BaseTool|null $tool tool + * + * @return $this + */ + public function setTool(?\Flat\APIClient\Model\LtiConfiguration1p3BaseTool $tool): static + { + if (is_null($tool)) { + throw new InvalidArgumentException('non-nullable tool cannot be null'); + } + $this->container['tool'] = $tool; + + return $this; + } + + /** + * Gets public_keyset_url + * + * @return string|null + */ + public function getPublicKeysetUrl(): ?string + { + return $this->container['public_keyset_url']; + } + + /** + * Sets public_keyset_url + * + * @param string|null $public_keyset_url Public keyset URL for the platform to retrieve Flat's public keys + * + * @return $this + */ + public function setPublicKeysetUrl(?string $public_keyset_url): static + { + if (is_null($public_keyset_url)) { + throw new InvalidArgumentException('non-nullable public_keyset_url cannot be null'); + } + $this->container['public_keyset_url'] = $public_keyset_url; + + return $this; + } + + /** + * Gets initiate_login_url + * + * @return string|null + */ + public function getInitiateLoginUrl(): ?string + { + return $this->container['initiate_login_url']; + } + + /** + * Sets initiate_login_url + * + * @param string|null $initiate_login_url URL for the platform to initiate LTI login + * + * @return $this + */ + public function setInitiateLoginUrl(?string $initiate_login_url): static + { + if (is_null($initiate_login_url)) { + throw new InvalidArgumentException('non-nullable initiate_login_url cannot be null'); + } + $this->container['initiate_login_url'] = $initiate_login_url; + + return $this; + } + + /** + * Gets redirect_uris + * + * @return string[]|null + */ + public function getRedirectUris(): ?array + { + return $this->container['redirect_uris']; + } + + /** + * Sets redirect_uris + * + * @param string[]|null $redirect_uris Allowed redirect URIs for LTI launches + * + * @return $this + */ + public function setRedirectUris(?array $redirect_uris): static + { + if (is_null($redirect_uris)) { + throw new InvalidArgumentException('non-nullable redirect_uris cannot be null'); + } + $this->container['redirect_uris'] = $redirect_uris; + + return $this; + } + + /** + * Gets enable_email_matching + * + * @return bool|null + */ + public function getEnableEmailMatching(): ?bool + { + return $this->container['enable_email_matching']; + } + + /** + * Sets enable_email_matching + * + * @param bool|null $enable_email_matching Enable email-based user matching during LTI authentication. When true (default): If a user with the same email exists in the organization, they will be matched and logged in instead of creating a new account. When false: Email matching is disabled. Only LTI ID matching is used, which means multiple LTI users can share the same email address and have separate Flat accounts. This is useful for cases like siblings sharing a parent email in the LMS. + * + * @return $this + */ + public function setEnableEmailMatching(?bool $enable_email_matching): static + { + if (is_null($enable_email_matching)) { + throw new InvalidArgumentException('non-nullable enable_email_matching cannot be null'); + } + $this->container['enable_email_matching'] = $enable_email_matching; + + return $this; + } + + /** + * Gets parent_id + * + * @return string|null + */ + public function getParentId(): ?string + { + return $this->container['parent_id']; + } + + /** + * Sets parent_id + * + * @param string|null $parent_id Parent configuration ID (for deployment-based configs) + * + * @return $this + */ + public function setParentId(?string $parent_id): static + { + if (is_null($parent_id)) { + throw new InvalidArgumentException('non-nullable parent_id cannot be null'); + } + $this->container['parent_id'] = $parent_id; + + return $this; + } + + /** + * Gets deployment_key + * + * @return string|null + */ + public function getDeploymentKey(): ?string + { + return $this->container['deployment_key']; + } + + /** + * Sets deployment_key + * + * @param string|null $deployment_key Deployment key (e.g., schoology, classlink) + * + * @return $this + */ + public function setDeploymentKey(?string $deployment_key): static + { + if (is_null($deployment_key)) { + throw new InvalidArgumentException('non-nullable deployment_key cannot be null'); + } + $this->container['deployment_key'] = $deployment_key; + + return $this; + } + + /** + * Gets deployment_breakdown_by + * + * @return string|null + */ + public function getDeploymentBreakdownBy(): ?string + { + return $this->container['deployment_breakdown_by']; + } + + /** + * Sets deployment_breakdown_by + * + * @param string|null $deployment_breakdown_by Custom claim used for tenant identification (parent platforms only, read-only) + * + * @return $this + */ + public function setDeploymentBreakdownBy(?string $deployment_breakdown_by): static + { + if (is_null($deployment_breakdown_by)) { + throw new InvalidArgumentException('non-nullable deployment_breakdown_by cannot be null'); + } + $this->container['deployment_breakdown_by'] = $deployment_breakdown_by; + + return $this; + } + + /** + * Gets deployment_breakdown_id + * + * @return string|null + */ + public function getDeploymentBreakdownId(): ?string + { + return $this->container['deployment_breakdown_id']; + } + + /** + * Sets deployment_breakdown_id + * + * @param string|null $deployment_breakdown_id Value of the custom claim that identifies this specific tenant (child platforms only) + * + * @return $this + */ + public function setDeploymentBreakdownId(?string $deployment_breakdown_id): static + { + if (is_null($deployment_breakdown_id)) { + throw new InvalidArgumentException('non-nullable deployment_breakdown_id cannot be null'); + } + $this->container['deployment_breakdown_id'] = $deployment_breakdown_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LtiConfiguration1p3Dynamic.php b/src/Model/LtiConfiguration1p3Dynamic.php new file mode 100644 index 0000000..250ce86 --- /dev/null +++ b/src/Model/LtiConfiguration1p3Dynamic.php @@ -0,0 +1,1418 @@ + + */ +class LtiConfiguration1p3Dynamic implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'LtiConfiguration1p3Dynamic'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'lti_version' => 'string', + 'organization_id' => 'string', + 'organization_name' => 'string', + 'creator_id' => 'string', + 'creation_date' => '\DateTime', + 'last_used_date' => '\DateTime', + 'status' => 'string', + 'mode' => 'string', + 'platform_iss' => 'string', + 'platform_name' => 'string', + 'client_id' => 'string', + 'deployment_id' => 'string', + 'access_token_url' => 'string', + 'authorization_url' => 'string', + 'jwks_url' => 'string', + 'deployment_mode' => 'string', + 'supported_services' => '\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices', + 'tool' => '\Flat\APIClient\Model\LtiConfiguration1p3BaseTool', + 'public_keyset_url' => 'string', + 'initiate_login_url' => 'string', + 'redirect_uris' => 'string[]', + 'enable_email_matching' => 'bool', + 'registration_token' => 'string', + 'registration_url' => 'string', + 'registration_token_used' => 'bool', + 'registration_completion_date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'lti_version' => null, + 'organization_id' => null, + 'organization_name' => null, + 'creator_id' => null, + 'creation_date' => 'date-time', + 'last_used_date' => 'date-time', + 'status' => null, + 'mode' => null, + 'platform_iss' => null, + 'platform_name' => null, + 'client_id' => null, + 'deployment_id' => null, + 'access_token_url' => 'url', + 'authorization_url' => 'url', + 'jwks_url' => 'url', + 'deployment_mode' => null, + 'supported_services' => null, + 'tool' => null, + 'public_keyset_url' => null, + 'initiate_login_url' => null, + 'redirect_uris' => null, + 'enable_email_matching' => null, + 'registration_token' => null, + 'registration_url' => 'url', + 'registration_token_used' => null, + 'registration_completion_date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'lti_version' => false, + 'organization_id' => false, + 'organization_name' => false, + 'creator_id' => false, + 'creation_date' => false, + 'last_used_date' => false, + 'status' => false, + 'mode' => false, + 'platform_iss' => false, + 'platform_name' => false, + 'client_id' => false, + 'deployment_id' => false, + 'access_token_url' => false, + 'authorization_url' => false, + 'jwks_url' => false, + 'deployment_mode' => false, + 'supported_services' => false, + 'tool' => false, + 'public_keyset_url' => false, + 'initiate_login_url' => false, + 'redirect_uris' => false, + 'enable_email_matching' => false, + 'registration_token' => false, + 'registration_url' => false, + 'registration_token_used' => false, + 'registration_completion_date' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'lti_version' => 'ltiVersion', + 'organization_id' => 'organizationId', + 'organization_name' => 'organizationName', + 'creator_id' => 'creatorId', + 'creation_date' => 'creationDate', + 'last_used_date' => 'lastUsedDate', + 'status' => 'status', + 'mode' => 'mode', + 'platform_iss' => 'platformIss', + 'platform_name' => 'platformName', + 'client_id' => 'clientId', + 'deployment_id' => 'deploymentId', + 'access_token_url' => 'accessTokenUrl', + 'authorization_url' => 'authorizationUrl', + 'jwks_url' => 'jwksUrl', + 'deployment_mode' => 'deploymentMode', + 'supported_services' => 'supportedServices', + 'tool' => 'tool', + 'public_keyset_url' => 'publicKeysetUrl', + 'initiate_login_url' => 'initiateLoginUrl', + 'redirect_uris' => 'redirectUris', + 'enable_email_matching' => 'enableEmailMatching', + 'registration_token' => 'registrationToken', + 'registration_url' => 'registrationUrl', + 'registration_token_used' => 'registrationTokenUsed', + 'registration_completion_date' => 'registrationCompletionDate' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'lti_version' => 'setLtiVersion', + 'organization_id' => 'setOrganizationId', + 'organization_name' => 'setOrganizationName', + 'creator_id' => 'setCreatorId', + 'creation_date' => 'setCreationDate', + 'last_used_date' => 'setLastUsedDate', + 'status' => 'setStatus', + 'mode' => 'setMode', + 'platform_iss' => 'setPlatformIss', + 'platform_name' => 'setPlatformName', + 'client_id' => 'setClientId', + 'deployment_id' => 'setDeploymentId', + 'access_token_url' => 'setAccessTokenUrl', + 'authorization_url' => 'setAuthorizationUrl', + 'jwks_url' => 'setJwksUrl', + 'deployment_mode' => 'setDeploymentMode', + 'supported_services' => 'setSupportedServices', + 'tool' => 'setTool', + 'public_keyset_url' => 'setPublicKeysetUrl', + 'initiate_login_url' => 'setInitiateLoginUrl', + 'redirect_uris' => 'setRedirectUris', + 'enable_email_matching' => 'setEnableEmailMatching', + 'registration_token' => 'setRegistrationToken', + 'registration_url' => 'setRegistrationUrl', + 'registration_token_used' => 'setRegistrationTokenUsed', + 'registration_completion_date' => 'setRegistrationCompletionDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'lti_version' => 'getLtiVersion', + 'organization_id' => 'getOrganizationId', + 'organization_name' => 'getOrganizationName', + 'creator_id' => 'getCreatorId', + 'creation_date' => 'getCreationDate', + 'last_used_date' => 'getLastUsedDate', + 'status' => 'getStatus', + 'mode' => 'getMode', + 'platform_iss' => 'getPlatformIss', + 'platform_name' => 'getPlatformName', + 'client_id' => 'getClientId', + 'deployment_id' => 'getDeploymentId', + 'access_token_url' => 'getAccessTokenUrl', + 'authorization_url' => 'getAuthorizationUrl', + 'jwks_url' => 'getJwksUrl', + 'deployment_mode' => 'getDeploymentMode', + 'supported_services' => 'getSupportedServices', + 'tool' => 'getTool', + 'public_keyset_url' => 'getPublicKeysetUrl', + 'initiate_login_url' => 'getInitiateLoginUrl', + 'redirect_uris' => 'getRedirectUris', + 'enable_email_matching' => 'getEnableEmailMatching', + 'registration_token' => 'getRegistrationToken', + 'registration_url' => 'getRegistrationUrl', + 'registration_token_used' => 'getRegistrationTokenUsed', + 'registration_completion_date' => 'getRegistrationCompletionDate' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const LTI_VERSION__1P3 = '1p3'; + public const STATUS_READY_TO_USE = 'ready-to-use'; + public const STATUS_IN_USE = 'in-use'; + public const STATUS_INCOMPLETE_SETUP = 'incomplete-setup'; + public const MODE__1P3_DYNAMIC = '1p3-dynamic'; + public const DEPLOYMENT_MODE_SINGLE = 'single'; + public const DEPLOYMENT_MODE_MULTI = 'multi'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getLtiVersionAllowableValues() + { + return [ + self::LTI_VERSION__1P3, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getStatusAllowableValues() + { + return [ + self::STATUS_READY_TO_USE, + self::STATUS_IN_USE, + self::STATUS_INCOMPLETE_SETUP, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getModeAllowableValues() + { + return [ + self::MODE__1P3_DYNAMIC, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getDeploymentModeAllowableValues() + { + return [ + self::DEPLOYMENT_MODE_SINGLE, + self::DEPLOYMENT_MODE_MULTI, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('lti_version', $data ?? [], null); + $this->setIfExists('organization_id', $data ?? [], null); + $this->setIfExists('organization_name', $data ?? [], null); + $this->setIfExists('creator_id', $data ?? [], null); + $this->setIfExists('creation_date', $data ?? [], null); + $this->setIfExists('last_used_date', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('mode', $data ?? [], null); + $this->setIfExists('platform_iss', $data ?? [], null); + $this->setIfExists('platform_name', $data ?? [], null); + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('deployment_id', $data ?? [], null); + $this->setIfExists('access_token_url', $data ?? [], null); + $this->setIfExists('authorization_url', $data ?? [], null); + $this->setIfExists('jwks_url', $data ?? [], null); + $this->setIfExists('deployment_mode', $data ?? [], null); + $this->setIfExists('supported_services', $data ?? [], null); + $this->setIfExists('tool', $data ?? [], null); + $this->setIfExists('public_keyset_url', $data ?? [], null); + $this->setIfExists('initiate_login_url', $data ?? [], null); + $this->setIfExists('redirect_uris', $data ?? [], null); + $this->setIfExists('enable_email_matching', $data ?? [], true); + $this->setIfExists('registration_token', $data ?? [], null); + $this->setIfExists('registration_url', $data ?? [], null); + $this->setIfExists('registration_token_used', $data ?? [], null); + $this->setIfExists('registration_completion_date', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['lti_version'] === null) { + $invalidProperties[] = "'lti_version' can't be null"; + } + $allowedValues = self::getLtiVersionAllowableValues(); + if (!is_null($this->container['lti_version']) && !in_array($this->container['lti_version'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'lti_version', must be one of '%s'", + $this->container['lti_version'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['creation_date'] === null) { + $invalidProperties[] = "'creation_date' can't be null"; + } + $allowedValues = self::getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = self::getModeAllowableValues(); + if (!is_null($this->container['mode']) && !in_array($this->container['mode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'mode', must be one of '%s'", + $this->container['mode'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = self::getDeploymentModeAllowableValues(); + if (!is_null($this->container['deployment_mode']) && !in_array($this->container['deployment_mode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'deployment_mode', must be one of '%s'", + $this->container['deployment_mode'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Configuration ID + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets lti_version + * + * @return string + */ + public function getLtiVersion(): string + { + return $this->container['lti_version']; + } + + /** + * Sets lti_version + * + * @param string $lti_version LTI version (1.3) + * + * @return $this + */ + public function setLtiVersion(string $lti_version): static + { + if (is_null($lti_version)) { + throw new InvalidArgumentException('non-nullable lti_version cannot be null'); + } + $allowedValues = self::getLtiVersionAllowableValues(); + if (!in_array($lti_version, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'lti_version', must be one of '%s'", + $lti_version, + implode("', '", $allowedValues) + ) + ); + } + $this->container['lti_version'] = $lti_version; + + return $this; + } + + /** + * Gets organization_id + * + * @return string|null + */ + public function getOrganizationId(): ?string + { + return $this->container['organization_id']; + } + + /** + * Sets organization_id + * + * @param string|null $organization_id Organization ID + * + * @return $this + */ + public function setOrganizationId(?string $organization_id): static + { + if (is_null($organization_id)) { + throw new InvalidArgumentException('non-nullable organization_id cannot be null'); + } + $this->container['organization_id'] = $organization_id; + + return $this; + } + + /** + * Gets organization_name + * + * @return string|null + */ + public function getOrganizationName(): ?string + { + return $this->container['organization_name']; + } + + /** + * Sets organization_name + * + * @param string|null $organization_name Organization name + * + * @return $this + */ + public function setOrganizationName(?string $organization_name): static + { + if (is_null($organization_name)) { + throw new InvalidArgumentException('non-nullable organization_name cannot be null'); + } + $this->container['organization_name'] = $organization_name; + + return $this; + } + + /** + * Gets creator_id + * + * @return string|null + */ + public function getCreatorId(): ?string + { + return $this->container['creator_id']; + } + + /** + * Sets creator_id + * + * @param string|null $creator_id ID of the user who created this configuration + * + * @return $this + */ + public function setCreatorId(?string $creator_id): static + { + if (is_null($creator_id)) { + throw new InvalidArgumentException('non-nullable creator_id cannot be null'); + } + $this->container['creator_id'] = $creator_id; + + return $this; + } + + /** + * Gets creation_date + * + * @return \DateTime + */ + public function getCreationDate(): \DateTime + { + return $this->container['creation_date']; + } + + /** + * Sets creation_date + * + * @param \DateTime $creation_date Configuration creation date + * + * @return $this + */ + public function setCreationDate(\DateTime $creation_date): static + { + if (is_null($creation_date)) { + throw new InvalidArgumentException('non-nullable creation_date cannot be null'); + } + $this->container['creation_date'] = $creation_date; + + return $this; + } + + /** + * Gets last_used_date + * + * @return \DateTime|null + */ + public function getLastUsedDate(): ?\DateTime + { + return $this->container['last_used_date']; + } + + /** + * Sets last_used_date + * + * @param \DateTime|null $last_used_date Last time this configuration was used + * + * @return $this + */ + public function setLastUsedDate(?\DateTime $last_used_date): static + { + if (is_null($last_used_date)) { + throw new InvalidArgumentException('non-nullable last_used_date cannot be null'); + } + $this->container['last_used_date'] = $last_used_date; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus(): ?string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Configuration status indicator + * + * @return $this + */ + public function setStatus(?string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = self::getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets mode + * + * @return string|null + */ + public function getMode(): ?string + { + return $this->container['mode']; + } + + /** + * Sets mode + * + * @param string|null $mode Dynamic registration LTI 1.3 configuration mode + * + * @return $this + */ + public function setMode(?string $mode): static + { + if (is_null($mode)) { + throw new InvalidArgumentException('non-nullable mode cannot be null'); + } + $allowedValues = self::getModeAllowableValues(); + if (!in_array($mode, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'mode', must be one of '%s'", + $mode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['mode'] = $mode; + + return $this; + } + + /** + * Gets platform_iss + * + * @return string|null + */ + public function getPlatformIss(): ?string + { + return $this->container['platform_iss']; + } + + /** + * Sets platform_iss + * + * @param string|null $platform_iss Platform issuer URL + * + * @return $this + */ + public function setPlatformIss(?string $platform_iss): static + { + if (is_null($platform_iss)) { + throw new InvalidArgumentException('non-nullable platform_iss cannot be null'); + } + $this->container['platform_iss'] = $platform_iss; + + return $this; + } + + /** + * Gets platform_name + * + * @return string|null + */ + public function getPlatformName(): ?string + { + return $this->container['platform_name']; + } + + /** + * Sets platform_name + * + * @param string|null $platform_name Platform display name + * + * @return $this + */ + public function setPlatformName(?string $platform_name): static + { + if (is_null($platform_name)) { + throw new InvalidArgumentException('non-nullable platform_name cannot be null'); + } + $this->container['platform_name'] = $platform_name; + + return $this; + } + + /** + * Gets client_id + * + * @return string|null + */ + public function getClientId(): ?string + { + return $this->container['client_id']; + } + + /** + * Sets client_id + * + * @param string|null $client_id OAuth2 client_id allocated by the platform + * + * @return $this + */ + public function setClientId(?string $client_id): static + { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } + $this->container['client_id'] = $client_id; + + return $this; + } + + /** + * Gets deployment_id + * + * @return string|null + */ + public function getDeploymentId(): ?string + { + return $this->container['deployment_id']; + } + + /** + * Sets deployment_id + * + * @param string|null $deployment_id Deployment ID linking the tool to a tenant/class (varies by platform) + * + * @return $this + */ + public function setDeploymentId(?string $deployment_id): static + { + if (is_null($deployment_id)) { + throw new InvalidArgumentException('non-nullable deployment_id cannot be null'); + } + $this->container['deployment_id'] = $deployment_id; + + return $this; + } + + /** + * Gets access_token_url + * + * @return string|null + */ + public function getAccessTokenUrl(): ?string + { + return $this->container['access_token_url']; + } + + /** + * Sets access_token_url + * + * @param string|null $access_token_url OAuth2 token endpoint (for AGS/NRPS) + * + * @return $this + */ + public function setAccessTokenUrl(?string $access_token_url): static + { + if (is_null($access_token_url)) { + throw new InvalidArgumentException('non-nullable access_token_url cannot be null'); + } + $this->container['access_token_url'] = $access_token_url; + + return $this; + } + + /** + * Gets authorization_url + * + * @return string|null + */ + public function getAuthorizationUrl(): ?string + { + return $this->container['authorization_url']; + } + + /** + * Sets authorization_url + * + * @param string|null $authorization_url OIDC authorization/login endpoint + * + * @return $this + */ + public function setAuthorizationUrl(?string $authorization_url): static + { + if (is_null($authorization_url)) { + throw new InvalidArgumentException('non-nullable authorization_url cannot be null'); + } + $this->container['authorization_url'] = $authorization_url; + + return $this; + } + + /** + * Gets jwks_url + * + * @return string|null + */ + public function getJwksUrl(): ?string + { + return $this->container['jwks_url']; + } + + /** + * Sets jwks_url + * + * @param string|null $jwks_url Platform JWKS endpoint (public keys) + * + * @return $this + */ + public function setJwksUrl(?string $jwks_url): static + { + if (is_null($jwks_url)) { + throw new InvalidArgumentException('non-nullable jwks_url cannot be null'); + } + $this->container['jwks_url'] = $jwks_url; + + return $this; + } + + /** + * Gets deployment_mode + * + * @return string|null + */ + public function getDeploymentMode(): ?string + { + return $this->container['deployment_mode']; + } + + /** + * Sets deployment_mode + * + * @param string|null $deployment_mode Deployment mode (single for organization-specific, multi for shared parent platforms) + * + * @return $this + */ + public function setDeploymentMode(?string $deployment_mode): static + { + if (is_null($deployment_mode)) { + throw new InvalidArgumentException('non-nullable deployment_mode cannot be null'); + } + $allowedValues = self::getDeploymentModeAllowableValues(); + if (!in_array($deployment_mode, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'deployment_mode', must be one of '%s'", + $deployment_mode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['deployment_mode'] = $deployment_mode; + + return $this; + } + + /** + * Gets supported_services + * + * @return \Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices|null + */ + public function getSupportedServices(): ?\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices + { + return $this->container['supported_services']; + } + + /** + * Sets supported_services + * + * @param \Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices|null $supported_services supported_services + * + * @return $this + */ + public function setSupportedServices(?\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices $supported_services): static + { + if (is_null($supported_services)) { + throw new InvalidArgumentException('non-nullable supported_services cannot be null'); + } + $this->container['supported_services'] = $supported_services; + + return $this; + } + + /** + * Gets tool + * + * @return \Flat\APIClient\Model\LtiConfiguration1p3BaseTool|null + */ + public function getTool(): ?\Flat\APIClient\Model\LtiConfiguration1p3BaseTool + { + return $this->container['tool']; + } + + /** + * Sets tool + * + * @param \Flat\APIClient\Model\LtiConfiguration1p3BaseTool|null $tool tool + * + * @return $this + */ + public function setTool(?\Flat\APIClient\Model\LtiConfiguration1p3BaseTool $tool): static + { + if (is_null($tool)) { + throw new InvalidArgumentException('non-nullable tool cannot be null'); + } + $this->container['tool'] = $tool; + + return $this; + } + + /** + * Gets public_keyset_url + * + * @return string|null + */ + public function getPublicKeysetUrl(): ?string + { + return $this->container['public_keyset_url']; + } + + /** + * Sets public_keyset_url + * + * @param string|null $public_keyset_url Public keyset URL for the platform to retrieve Flat's public keys + * + * @return $this + */ + public function setPublicKeysetUrl(?string $public_keyset_url): static + { + if (is_null($public_keyset_url)) { + throw new InvalidArgumentException('non-nullable public_keyset_url cannot be null'); + } + $this->container['public_keyset_url'] = $public_keyset_url; + + return $this; + } + + /** + * Gets initiate_login_url + * + * @return string|null + */ + public function getInitiateLoginUrl(): ?string + { + return $this->container['initiate_login_url']; + } + + /** + * Sets initiate_login_url + * + * @param string|null $initiate_login_url URL for the platform to initiate LTI login + * + * @return $this + */ + public function setInitiateLoginUrl(?string $initiate_login_url): static + { + if (is_null($initiate_login_url)) { + throw new InvalidArgumentException('non-nullable initiate_login_url cannot be null'); + } + $this->container['initiate_login_url'] = $initiate_login_url; + + return $this; + } + + /** + * Gets redirect_uris + * + * @return string[]|null + */ + public function getRedirectUris(): ?array + { + return $this->container['redirect_uris']; + } + + /** + * Sets redirect_uris + * + * @param string[]|null $redirect_uris Allowed redirect URIs for LTI launches + * + * @return $this + */ + public function setRedirectUris(?array $redirect_uris): static + { + if (is_null($redirect_uris)) { + throw new InvalidArgumentException('non-nullable redirect_uris cannot be null'); + } + $this->container['redirect_uris'] = $redirect_uris; + + return $this; + } + + /** + * Gets enable_email_matching + * + * @return bool|null + */ + public function getEnableEmailMatching(): ?bool + { + return $this->container['enable_email_matching']; + } + + /** + * Sets enable_email_matching + * + * @param bool|null $enable_email_matching Enable email-based user matching during LTI authentication. When true (default): If a user with the same email exists in the organization, they will be matched and logged in instead of creating a new account. When false: Email matching is disabled. Only LTI ID matching is used, which means multiple LTI users can share the same email address and have separate Flat accounts. This is useful for cases like siblings sharing a parent email in the LMS. + * + * @return $this + */ + public function setEnableEmailMatching(?bool $enable_email_matching): static + { + if (is_null($enable_email_matching)) { + throw new InvalidArgumentException('non-nullable enable_email_matching cannot be null'); + } + $this->container['enable_email_matching'] = $enable_email_matching; + + return $this; + } + + /** + * Gets registration_token + * + * @return string|null + */ + public function getRegistrationToken(): ?string + { + return $this->container['registration_token']; + } + + /** + * Sets registration_token + * + * @param string|null $registration_token Only included for admins + * + * @return $this + */ + public function setRegistrationToken(?string $registration_token): static + { + if (is_null($registration_token)) { + throw new InvalidArgumentException('non-nullable registration_token cannot be null'); + } + $this->container['registration_token'] = $registration_token; + + return $this; + } + + /** + * Gets registration_url + * + * @return string|null + */ + public function getRegistrationUrl(): ?string + { + return $this->container['registration_url']; + } + + /** + * Sets registration_url + * + * @param string|null $registration_url Dynamic registration URL (only included for admins when available) + * + * @return $this + */ + public function setRegistrationUrl(?string $registration_url): static + { + if (is_null($registration_url)) { + throw new InvalidArgumentException('non-nullable registration_url cannot be null'); + } + $this->container['registration_url'] = $registration_url; + + return $this; + } + + /** + * Gets registration_token_used + * + * @return bool|null + */ + public function getRegistrationTokenUsed(): ?bool + { + return $this->container['registration_token_used']; + } + + /** + * Sets registration_token_used + * + * @param bool|null $registration_token_used Whether dynamic registration token has been used + * + * @return $this + */ + public function setRegistrationTokenUsed(?bool $registration_token_used): static + { + if (is_null($registration_token_used)) { + throw new InvalidArgumentException('non-nullable registration_token_used cannot be null'); + } + $this->container['registration_token_used'] = $registration_token_used; + + return $this; + } + + /** + * Gets registration_completion_date + * + * @return \DateTime|null + */ + public function getRegistrationCompletionDate(): ?\DateTime + { + return $this->container['registration_completion_date']; + } + + /** + * Sets registration_completion_date + * + * @param \DateTime|null $registration_completion_date Date when dynamic registration completed (null when not completed) + * + * @return $this + */ + public function setRegistrationCompletionDate(?\DateTime $registration_completion_date): static + { + if (is_null($registration_completion_date)) { + array_push($this->openAPINullablesSetToNull, 'registration_completion_date'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('registration_completion_date', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['registration_completion_date'] = $registration_completion_date; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LtiConfiguration1p3Manual.php b/src/Model/LtiConfiguration1p3Manual.php new file mode 100644 index 0000000..c457d82 --- /dev/null +++ b/src/Model/LtiConfiguration1p3Manual.php @@ -0,0 +1,1275 @@ + + */ +class LtiConfiguration1p3Manual implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'LtiConfiguration1p3Manual'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'lti_version' => 'string', + 'organization_id' => 'string', + 'organization_name' => 'string', + 'creator_id' => 'string', + 'creation_date' => '\DateTime', + 'last_used_date' => '\DateTime', + 'status' => 'string', + 'mode' => 'string', + 'platform_iss' => 'string', + 'platform_name' => 'string', + 'client_id' => 'string', + 'deployment_id' => 'string', + 'access_token_url' => 'string', + 'authorization_url' => 'string', + 'jwks_url' => 'string', + 'deployment_mode' => 'string', + 'supported_services' => '\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices', + 'tool' => '\Flat\APIClient\Model\LtiConfiguration1p3BaseTool', + 'public_keyset_url' => 'string', + 'initiate_login_url' => 'string', + 'redirect_uris' => 'string[]', + 'enable_email_matching' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'lti_version' => null, + 'organization_id' => null, + 'organization_name' => null, + 'creator_id' => null, + 'creation_date' => 'date-time', + 'last_used_date' => 'date-time', + 'status' => null, + 'mode' => null, + 'platform_iss' => null, + 'platform_name' => null, + 'client_id' => null, + 'deployment_id' => null, + 'access_token_url' => 'url', + 'authorization_url' => 'url', + 'jwks_url' => 'url', + 'deployment_mode' => null, + 'supported_services' => null, + 'tool' => null, + 'public_keyset_url' => null, + 'initiate_login_url' => null, + 'redirect_uris' => null, + 'enable_email_matching' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'lti_version' => false, + 'organization_id' => false, + 'organization_name' => false, + 'creator_id' => false, + 'creation_date' => false, + 'last_used_date' => false, + 'status' => false, + 'mode' => false, + 'platform_iss' => false, + 'platform_name' => false, + 'client_id' => false, + 'deployment_id' => false, + 'access_token_url' => false, + 'authorization_url' => false, + 'jwks_url' => false, + 'deployment_mode' => false, + 'supported_services' => false, + 'tool' => false, + 'public_keyset_url' => false, + 'initiate_login_url' => false, + 'redirect_uris' => false, + 'enable_email_matching' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'lti_version' => 'ltiVersion', + 'organization_id' => 'organizationId', + 'organization_name' => 'organizationName', + 'creator_id' => 'creatorId', + 'creation_date' => 'creationDate', + 'last_used_date' => 'lastUsedDate', + 'status' => 'status', + 'mode' => 'mode', + 'platform_iss' => 'platformIss', + 'platform_name' => 'platformName', + 'client_id' => 'clientId', + 'deployment_id' => 'deploymentId', + 'access_token_url' => 'accessTokenUrl', + 'authorization_url' => 'authorizationUrl', + 'jwks_url' => 'jwksUrl', + 'deployment_mode' => 'deploymentMode', + 'supported_services' => 'supportedServices', + 'tool' => 'tool', + 'public_keyset_url' => 'publicKeysetUrl', + 'initiate_login_url' => 'initiateLoginUrl', + 'redirect_uris' => 'redirectUris', + 'enable_email_matching' => 'enableEmailMatching' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'lti_version' => 'setLtiVersion', + 'organization_id' => 'setOrganizationId', + 'organization_name' => 'setOrganizationName', + 'creator_id' => 'setCreatorId', + 'creation_date' => 'setCreationDate', + 'last_used_date' => 'setLastUsedDate', + 'status' => 'setStatus', + 'mode' => 'setMode', + 'platform_iss' => 'setPlatformIss', + 'platform_name' => 'setPlatformName', + 'client_id' => 'setClientId', + 'deployment_id' => 'setDeploymentId', + 'access_token_url' => 'setAccessTokenUrl', + 'authorization_url' => 'setAuthorizationUrl', + 'jwks_url' => 'setJwksUrl', + 'deployment_mode' => 'setDeploymentMode', + 'supported_services' => 'setSupportedServices', + 'tool' => 'setTool', + 'public_keyset_url' => 'setPublicKeysetUrl', + 'initiate_login_url' => 'setInitiateLoginUrl', + 'redirect_uris' => 'setRedirectUris', + 'enable_email_matching' => 'setEnableEmailMatching' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'lti_version' => 'getLtiVersion', + 'organization_id' => 'getOrganizationId', + 'organization_name' => 'getOrganizationName', + 'creator_id' => 'getCreatorId', + 'creation_date' => 'getCreationDate', + 'last_used_date' => 'getLastUsedDate', + 'status' => 'getStatus', + 'mode' => 'getMode', + 'platform_iss' => 'getPlatformIss', + 'platform_name' => 'getPlatformName', + 'client_id' => 'getClientId', + 'deployment_id' => 'getDeploymentId', + 'access_token_url' => 'getAccessTokenUrl', + 'authorization_url' => 'getAuthorizationUrl', + 'jwks_url' => 'getJwksUrl', + 'deployment_mode' => 'getDeploymentMode', + 'supported_services' => 'getSupportedServices', + 'tool' => 'getTool', + 'public_keyset_url' => 'getPublicKeysetUrl', + 'initiate_login_url' => 'getInitiateLoginUrl', + 'redirect_uris' => 'getRedirectUris', + 'enable_email_matching' => 'getEnableEmailMatching' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const LTI_VERSION__1P3 = '1p3'; + public const STATUS_READY_TO_USE = 'ready-to-use'; + public const STATUS_IN_USE = 'in-use'; + public const STATUS_INCOMPLETE_SETUP = 'incomplete-setup'; + public const MODE__1P3_MANUAL = '1p3-manual'; + public const DEPLOYMENT_MODE_SINGLE = 'single'; + public const DEPLOYMENT_MODE_MULTI = 'multi'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getLtiVersionAllowableValues() + { + return [ + self::LTI_VERSION__1P3, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getStatusAllowableValues() + { + return [ + self::STATUS_READY_TO_USE, + self::STATUS_IN_USE, + self::STATUS_INCOMPLETE_SETUP, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getModeAllowableValues() + { + return [ + self::MODE__1P3_MANUAL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getDeploymentModeAllowableValues() + { + return [ + self::DEPLOYMENT_MODE_SINGLE, + self::DEPLOYMENT_MODE_MULTI, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('lti_version', $data ?? [], null); + $this->setIfExists('organization_id', $data ?? [], null); + $this->setIfExists('organization_name', $data ?? [], null); + $this->setIfExists('creator_id', $data ?? [], null); + $this->setIfExists('creation_date', $data ?? [], null); + $this->setIfExists('last_used_date', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('mode', $data ?? [], null); + $this->setIfExists('platform_iss', $data ?? [], null); + $this->setIfExists('platform_name', $data ?? [], null); + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('deployment_id', $data ?? [], null); + $this->setIfExists('access_token_url', $data ?? [], null); + $this->setIfExists('authorization_url', $data ?? [], null); + $this->setIfExists('jwks_url', $data ?? [], null); + $this->setIfExists('deployment_mode', $data ?? [], null); + $this->setIfExists('supported_services', $data ?? [], null); + $this->setIfExists('tool', $data ?? [], null); + $this->setIfExists('public_keyset_url', $data ?? [], null); + $this->setIfExists('initiate_login_url', $data ?? [], null); + $this->setIfExists('redirect_uris', $data ?? [], null); + $this->setIfExists('enable_email_matching', $data ?? [], true); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['lti_version'] === null) { + $invalidProperties[] = "'lti_version' can't be null"; + } + $allowedValues = self::getLtiVersionAllowableValues(); + if (!is_null($this->container['lti_version']) && !in_array($this->container['lti_version'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'lti_version', must be one of '%s'", + $this->container['lti_version'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['creation_date'] === null) { + $invalidProperties[] = "'creation_date' can't be null"; + } + $allowedValues = self::getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = self::getModeAllowableValues(); + if (!is_null($this->container['mode']) && !in_array($this->container['mode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'mode', must be one of '%s'", + $this->container['mode'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = self::getDeploymentModeAllowableValues(); + if (!is_null($this->container['deployment_mode']) && !in_array($this->container['deployment_mode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'deployment_mode', must be one of '%s'", + $this->container['deployment_mode'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Configuration ID + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets lti_version + * + * @return string + */ + public function getLtiVersion(): string + { + return $this->container['lti_version']; + } + + /** + * Sets lti_version + * + * @param string $lti_version LTI version (1.3) + * + * @return $this + */ + public function setLtiVersion(string $lti_version): static + { + if (is_null($lti_version)) { + throw new InvalidArgumentException('non-nullable lti_version cannot be null'); + } + $allowedValues = self::getLtiVersionAllowableValues(); + if (!in_array($lti_version, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'lti_version', must be one of '%s'", + $lti_version, + implode("', '", $allowedValues) + ) + ); + } + $this->container['lti_version'] = $lti_version; + + return $this; + } + + /** + * Gets organization_id + * + * @return string|null + */ + public function getOrganizationId(): ?string + { + return $this->container['organization_id']; + } + + /** + * Sets organization_id + * + * @param string|null $organization_id Organization ID + * + * @return $this + */ + public function setOrganizationId(?string $organization_id): static + { + if (is_null($organization_id)) { + throw new InvalidArgumentException('non-nullable organization_id cannot be null'); + } + $this->container['organization_id'] = $organization_id; + + return $this; + } + + /** + * Gets organization_name + * + * @return string|null + */ + public function getOrganizationName(): ?string + { + return $this->container['organization_name']; + } + + /** + * Sets organization_name + * + * @param string|null $organization_name Organization name + * + * @return $this + */ + public function setOrganizationName(?string $organization_name): static + { + if (is_null($organization_name)) { + throw new InvalidArgumentException('non-nullable organization_name cannot be null'); + } + $this->container['organization_name'] = $organization_name; + + return $this; + } + + /** + * Gets creator_id + * + * @return string|null + */ + public function getCreatorId(): ?string + { + return $this->container['creator_id']; + } + + /** + * Sets creator_id + * + * @param string|null $creator_id ID of the user who created this configuration + * + * @return $this + */ + public function setCreatorId(?string $creator_id): static + { + if (is_null($creator_id)) { + throw new InvalidArgumentException('non-nullable creator_id cannot be null'); + } + $this->container['creator_id'] = $creator_id; + + return $this; + } + + /** + * Gets creation_date + * + * @return \DateTime + */ + public function getCreationDate(): \DateTime + { + return $this->container['creation_date']; + } + + /** + * Sets creation_date + * + * @param \DateTime $creation_date Configuration creation date + * + * @return $this + */ + public function setCreationDate(\DateTime $creation_date): static + { + if (is_null($creation_date)) { + throw new InvalidArgumentException('non-nullable creation_date cannot be null'); + } + $this->container['creation_date'] = $creation_date; + + return $this; + } + + /** + * Gets last_used_date + * + * @return \DateTime|null + */ + public function getLastUsedDate(): ?\DateTime + { + return $this->container['last_used_date']; + } + + /** + * Sets last_used_date + * + * @param \DateTime|null $last_used_date Last time this configuration was used + * + * @return $this + */ + public function setLastUsedDate(?\DateTime $last_used_date): static + { + if (is_null($last_used_date)) { + throw new InvalidArgumentException('non-nullable last_used_date cannot be null'); + } + $this->container['last_used_date'] = $last_used_date; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus(): ?string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Configuration status indicator + * + * @return $this + */ + public function setStatus(?string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = self::getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets mode + * + * @return string|null + */ + public function getMode(): ?string + { + return $this->container['mode']; + } + + /** + * Sets mode + * + * @param string|null $mode Manual LTI 1.3 configuration mode + * + * @return $this + */ + public function setMode(?string $mode): static + { + if (is_null($mode)) { + throw new InvalidArgumentException('non-nullable mode cannot be null'); + } + $allowedValues = self::getModeAllowableValues(); + if (!in_array($mode, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'mode', must be one of '%s'", + $mode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['mode'] = $mode; + + return $this; + } + + /** + * Gets platform_iss + * + * @return string|null + */ + public function getPlatformIss(): ?string + { + return $this->container['platform_iss']; + } + + /** + * Sets platform_iss + * + * @param string|null $platform_iss Platform issuer URL + * + * @return $this + */ + public function setPlatformIss(?string $platform_iss): static + { + if (is_null($platform_iss)) { + throw new InvalidArgumentException('non-nullable platform_iss cannot be null'); + } + $this->container['platform_iss'] = $platform_iss; + + return $this; + } + + /** + * Gets platform_name + * + * @return string|null + */ + public function getPlatformName(): ?string + { + return $this->container['platform_name']; + } + + /** + * Sets platform_name + * + * @param string|null $platform_name Platform display name + * + * @return $this + */ + public function setPlatformName(?string $platform_name): static + { + if (is_null($platform_name)) { + throw new InvalidArgumentException('non-nullable platform_name cannot be null'); + } + $this->container['platform_name'] = $platform_name; + + return $this; + } + + /** + * Gets client_id + * + * @return string|null + */ + public function getClientId(): ?string + { + return $this->container['client_id']; + } + + /** + * Sets client_id + * + * @param string|null $client_id OAuth2 client_id allocated by the platform + * + * @return $this + */ + public function setClientId(?string $client_id): static + { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } + $this->container['client_id'] = $client_id; + + return $this; + } + + /** + * Gets deployment_id + * + * @return string|null + */ + public function getDeploymentId(): ?string + { + return $this->container['deployment_id']; + } + + /** + * Sets deployment_id + * + * @param string|null $deployment_id Deployment ID linking the tool to a tenant/class (varies by platform) + * + * @return $this + */ + public function setDeploymentId(?string $deployment_id): static + { + if (is_null($deployment_id)) { + throw new InvalidArgumentException('non-nullable deployment_id cannot be null'); + } + $this->container['deployment_id'] = $deployment_id; + + return $this; + } + + /** + * Gets access_token_url + * + * @return string|null + */ + public function getAccessTokenUrl(): ?string + { + return $this->container['access_token_url']; + } + + /** + * Sets access_token_url + * + * @param string|null $access_token_url OAuth2 token endpoint (for AGS/NRPS) + * + * @return $this + */ + public function setAccessTokenUrl(?string $access_token_url): static + { + if (is_null($access_token_url)) { + throw new InvalidArgumentException('non-nullable access_token_url cannot be null'); + } + $this->container['access_token_url'] = $access_token_url; + + return $this; + } + + /** + * Gets authorization_url + * + * @return string|null + */ + public function getAuthorizationUrl(): ?string + { + return $this->container['authorization_url']; + } + + /** + * Sets authorization_url + * + * @param string|null $authorization_url OIDC authorization/login endpoint + * + * @return $this + */ + public function setAuthorizationUrl(?string $authorization_url): static + { + if (is_null($authorization_url)) { + throw new InvalidArgumentException('non-nullable authorization_url cannot be null'); + } + $this->container['authorization_url'] = $authorization_url; + + return $this; + } + + /** + * Gets jwks_url + * + * @return string|null + */ + public function getJwksUrl(): ?string + { + return $this->container['jwks_url']; + } + + /** + * Sets jwks_url + * + * @param string|null $jwks_url Platform JWKS endpoint (public keys) + * + * @return $this + */ + public function setJwksUrl(?string $jwks_url): static + { + if (is_null($jwks_url)) { + throw new InvalidArgumentException('non-nullable jwks_url cannot be null'); + } + $this->container['jwks_url'] = $jwks_url; + + return $this; + } + + /** + * Gets deployment_mode + * + * @return string|null + */ + public function getDeploymentMode(): ?string + { + return $this->container['deployment_mode']; + } + + /** + * Sets deployment_mode + * + * @param string|null $deployment_mode Deployment mode (single for organization-specific, multi for shared parent platforms) + * + * @return $this + */ + public function setDeploymentMode(?string $deployment_mode): static + { + if (is_null($deployment_mode)) { + throw new InvalidArgumentException('non-nullable deployment_mode cannot be null'); + } + $allowedValues = self::getDeploymentModeAllowableValues(); + if (!in_array($deployment_mode, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'deployment_mode', must be one of '%s'", + $deployment_mode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['deployment_mode'] = $deployment_mode; + + return $this; + } + + /** + * Gets supported_services + * + * @return \Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices|null + */ + public function getSupportedServices(): ?\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices + { + return $this->container['supported_services']; + } + + /** + * Sets supported_services + * + * @param \Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices|null $supported_services supported_services + * + * @return $this + */ + public function setSupportedServices(?\Flat\APIClient\Model\LtiConfiguration1p3BaseSupportedServices $supported_services): static + { + if (is_null($supported_services)) { + throw new InvalidArgumentException('non-nullable supported_services cannot be null'); + } + $this->container['supported_services'] = $supported_services; + + return $this; + } + + /** + * Gets tool + * + * @return \Flat\APIClient\Model\LtiConfiguration1p3BaseTool|null + */ + public function getTool(): ?\Flat\APIClient\Model\LtiConfiguration1p3BaseTool + { + return $this->container['tool']; + } + + /** + * Sets tool + * + * @param \Flat\APIClient\Model\LtiConfiguration1p3BaseTool|null $tool tool + * + * @return $this + */ + public function setTool(?\Flat\APIClient\Model\LtiConfiguration1p3BaseTool $tool): static + { + if (is_null($tool)) { + throw new InvalidArgumentException('non-nullable tool cannot be null'); + } + $this->container['tool'] = $tool; + + return $this; + } + + /** + * Gets public_keyset_url + * + * @return string|null + */ + public function getPublicKeysetUrl(): ?string + { + return $this->container['public_keyset_url']; + } + + /** + * Sets public_keyset_url + * + * @param string|null $public_keyset_url Public keyset URL for the platform to retrieve Flat's public keys + * + * @return $this + */ + public function setPublicKeysetUrl(?string $public_keyset_url): static + { + if (is_null($public_keyset_url)) { + throw new InvalidArgumentException('non-nullable public_keyset_url cannot be null'); + } + $this->container['public_keyset_url'] = $public_keyset_url; + + return $this; + } + + /** + * Gets initiate_login_url + * + * @return string|null + */ + public function getInitiateLoginUrl(): ?string + { + return $this->container['initiate_login_url']; + } + + /** + * Sets initiate_login_url + * + * @param string|null $initiate_login_url URL for the platform to initiate LTI login + * + * @return $this + */ + public function setInitiateLoginUrl(?string $initiate_login_url): static + { + if (is_null($initiate_login_url)) { + throw new InvalidArgumentException('non-nullable initiate_login_url cannot be null'); + } + $this->container['initiate_login_url'] = $initiate_login_url; + + return $this; + } + + /** + * Gets redirect_uris + * + * @return string[]|null + */ + public function getRedirectUris(): ?array + { + return $this->container['redirect_uris']; + } + + /** + * Sets redirect_uris + * + * @param string[]|null $redirect_uris Allowed redirect URIs for LTI launches + * + * @return $this + */ + public function setRedirectUris(?array $redirect_uris): static + { + if (is_null($redirect_uris)) { + throw new InvalidArgumentException('non-nullable redirect_uris cannot be null'); + } + $this->container['redirect_uris'] = $redirect_uris; + + return $this; + } + + /** + * Gets enable_email_matching + * + * @return bool|null + */ + public function getEnableEmailMatching(): ?bool + { + return $this->container['enable_email_matching']; + } + + /** + * Sets enable_email_matching + * + * @param bool|null $enable_email_matching Enable email-based user matching during LTI authentication. When true (default): If a user with the same email exists in the organization, they will be matched and logged in instead of creating a new account. When false: Email matching is disabled. Only LTI ID matching is used, which means multiple LTI users can share the same email address and have separate Flat accounts. This is useful for cases like siblings sharing a parent email in the LMS. + * + * @return $this + */ + public function setEnableEmailMatching(?bool $enable_email_matching): static + { + if (is_null($enable_email_matching)) { + throw new InvalidArgumentException('non-nullable enable_email_matching cannot be null'); + } + $this->container['enable_email_matching'] = $enable_email_matching; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LtiConfigurationBase.php b/src/Model/LtiConfigurationBase.php new file mode 100644 index 0000000..ee4716f --- /dev/null +++ b/src/Model/LtiConfigurationBase.php @@ -0,0 +1,708 @@ + + */ +class LtiConfigurationBase implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'LtiConfigurationBase'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'lti_version' => 'string', + 'organization_id' => 'string', + 'organization_name' => 'string', + 'creator_id' => 'string', + 'creation_date' => '\DateTime', + 'last_used_date' => '\DateTime', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'lti_version' => null, + 'organization_id' => null, + 'organization_name' => null, + 'creator_id' => null, + 'creation_date' => 'date-time', + 'last_used_date' => 'date-time', + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'lti_version' => false, + 'organization_id' => false, + 'organization_name' => false, + 'creator_id' => false, + 'creation_date' => false, + 'last_used_date' => true, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'lti_version' => 'ltiVersion', + 'organization_id' => 'organizationId', + 'organization_name' => 'organizationName', + 'creator_id' => 'creatorId', + 'creation_date' => 'creationDate', + 'last_used_date' => 'lastUsedDate', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'lti_version' => 'setLtiVersion', + 'organization_id' => 'setOrganizationId', + 'organization_name' => 'setOrganizationName', + 'creator_id' => 'setCreatorId', + 'creation_date' => 'setCreationDate', + 'last_used_date' => 'setLastUsedDate', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'lti_version' => 'getLtiVersion', + 'organization_id' => 'getOrganizationId', + 'organization_name' => 'getOrganizationName', + 'creator_id' => 'getCreatorId', + 'creation_date' => 'getCreationDate', + 'last_used_date' => 'getLastUsedDate', + 'status' => 'getStatus' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const LTI_VERSION__1P1 = '1p1'; + public const LTI_VERSION__1P3 = '1p3'; + public const STATUS_READY_TO_USE = 'ready-to-use'; + public const STATUS_IN_USE = 'in-use'; + public const STATUS_INCOMPLETE_SETUP = 'incomplete-setup'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getLtiVersionAllowableValues() + { + return [ + self::LTI_VERSION__1P1, + self::LTI_VERSION__1P3, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getStatusAllowableValues() + { + return [ + self::STATUS_READY_TO_USE, + self::STATUS_IN_USE, + self::STATUS_INCOMPLETE_SETUP, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('lti_version', $data ?? [], null); + $this->setIfExists('organization_id', $data ?? [], null); + $this->setIfExists('organization_name', $data ?? [], null); + $this->setIfExists('creator_id', $data ?? [], null); + $this->setIfExists('creation_date', $data ?? [], null); + $this->setIfExists('last_used_date', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['lti_version'] === null) { + $invalidProperties[] = "'lti_version' can't be null"; + } + $allowedValues = self::getLtiVersionAllowableValues(); + if (!is_null($this->container['lti_version']) && !in_array($this->container['lti_version'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'lti_version', must be one of '%s'", + $this->container['lti_version'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['creation_date'] === null) { + $invalidProperties[] = "'creation_date' can't be null"; + } + $allowedValues = self::getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Configuration ID + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets lti_version + * + * @return string + */ + public function getLtiVersion(): string + { + return $this->container['lti_version']; + } + + /** + * Sets lti_version + * + * @param string $lti_version LTI version + * + * @return $this + */ + public function setLtiVersion(string $lti_version): static + { + if (is_null($lti_version)) { + throw new InvalidArgumentException('non-nullable lti_version cannot be null'); + } + $allowedValues = self::getLtiVersionAllowableValues(); + if (!in_array($lti_version, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'lti_version', must be one of '%s'", + $lti_version, + implode("', '", $allowedValues) + ) + ); + } + $this->container['lti_version'] = $lti_version; + + return $this; + } + + /** + * Gets organization_id + * + * @return string|null + */ + public function getOrganizationId(): ?string + { + return $this->container['organization_id']; + } + + /** + * Sets organization_id + * + * @param string|null $organization_id Organization ID + * + * @return $this + */ + public function setOrganizationId(?string $organization_id): static + { + if (is_null($organization_id)) { + throw new InvalidArgumentException('non-nullable organization_id cannot be null'); + } + $this->container['organization_id'] = $organization_id; + + return $this; + } + + /** + * Gets organization_name + * + * @return string|null + */ + public function getOrganizationName(): ?string + { + return $this->container['organization_name']; + } + + /** + * Sets organization_name + * + * @param string|null $organization_name Organization name + * + * @return $this + */ + public function setOrganizationName(?string $organization_name): static + { + if (is_null($organization_name)) { + throw new InvalidArgumentException('non-nullable organization_name cannot be null'); + } + $this->container['organization_name'] = $organization_name; + + return $this; + } + + /** + * Gets creator_id + * + * @return string|null + */ + public function getCreatorId(): ?string + { + return $this->container['creator_id']; + } + + /** + * Sets creator_id + * + * @param string|null $creator_id ID of the user who created this configuration + * + * @return $this + */ + public function setCreatorId(?string $creator_id): static + { + if (is_null($creator_id)) { + throw new InvalidArgumentException('non-nullable creator_id cannot be null'); + } + $this->container['creator_id'] = $creator_id; + + return $this; + } + + /** + * Gets creation_date + * + * @return \DateTime + */ + public function getCreationDate(): \DateTime + { + return $this->container['creation_date']; + } + + /** + * Sets creation_date + * + * @param \DateTime $creation_date Configuration creation date + * + * @return $this + */ + public function setCreationDate(\DateTime $creation_date): static + { + if (is_null($creation_date)) { + throw new InvalidArgumentException('non-nullable creation_date cannot be null'); + } + $this->container['creation_date'] = $creation_date; + + return $this; + } + + /** + * Gets last_used_date + * + * @return \DateTime|null + */ + public function getLastUsedDate(): ?\DateTime + { + return $this->container['last_used_date']; + } + + /** + * Sets last_used_date + * + * @param \DateTime|null $last_used_date Last time this configuration was used + * + * @return $this + */ + public function setLastUsedDate(?\DateTime $last_used_date): static + { + if (is_null($last_used_date)) { + array_push($this->openAPINullablesSetToNull, 'last_used_date'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('last_used_date', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['last_used_date'] = $last_used_date; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus(): ?string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Configuration status indicator + * + * @return $this + */ + public function setStatus(?string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = self::getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LtiConfigurationCreate.php b/src/Model/LtiConfigurationCreate.php new file mode 100644 index 0000000..e5e2ca7 --- /dev/null +++ b/src/Model/LtiConfigurationCreate.php @@ -0,0 +1,90 @@ + '\Flat\APIClient\Model\LtiConfigurationCreate1p1', + '1p3-deployment' => '\Flat\APIClient\Model\LtiConfigurationCreate1p3Deployment', + '1p3-dynamic' => '\Flat\APIClient\Model\LtiConfigurationCreate1p3Dynamic', + '1p3-manual' => '\Flat\APIClient\Model\LtiConfigurationCreate1p3Manual' + ]; + } +} + + diff --git a/src/Model/LtiConfigurationCreate1p1.php b/src/Model/LtiConfigurationCreate1p1.php new file mode 100644 index 0000000..53c57f5 --- /dev/null +++ b/src/Model/LtiConfigurationCreate1p1.php @@ -0,0 +1,488 @@ + + */ +class LtiConfigurationCreate1p1 implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'LtiConfigurationCreate1p1'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'mode' => 'string', + 'name' => 'string', + 'lms' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'mode' => null, + 'name' => null, + 'lms' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'mode' => false, + 'name' => false, + 'lms' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'mode' => 'mode', + 'name' => 'name', + 'lms' => 'lms' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'mode' => 'setMode', + 'name' => 'setName', + 'lms' => 'setLms' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'mode' => 'getMode', + 'name' => 'getName', + 'lms' => 'getLms' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const MODE__1P1_MANUAL = '1p1-manual'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getModeAllowableValues() + { + return [ + self::MODE__1P1_MANUAL, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('mode', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('lms', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['mode'] === null) { + $invalidProperties[] = "'mode' can't be null"; + } + $allowedValues = self::getModeAllowableValues(); + if (!is_null($this->container['mode']) && !in_array($this->container['mode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'mode', must be one of '%s'", + $this->container['mode'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets mode + * + * @return string + */ + public function getMode(): string + { + return $this->container['mode']; + } + + /** + * Sets mode + * + * @param string $mode LTI 1.1 manual creation mode + * + * @return $this + */ + public function setMode(string $mode): static + { + if (is_null($mode)) { + throw new InvalidArgumentException('non-nullable mode cannot be null'); + } + $allowedValues = self::getModeAllowableValues(); + if (!in_array($mode, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'mode', must be one of '%s'", + $mode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['mode'] = $mode; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Display name for LTI 1.1 credentials + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets lms + * + * @return string|null + */ + public function getLms(): ?string + { + return $this->container['lms']; + } + + /** + * Sets lms + * + * @param string|null $lms LMS identifier for LTI 1.1 credentials + * + * @return $this + */ + public function setLms(?string $lms): static + { + if (is_null($lms)) { + throw new InvalidArgumentException('non-nullable lms cannot be null'); + } + $this->container['lms'] = $lms; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LtiConfigurationCreate1p3Deployment.php b/src/Model/LtiConfigurationCreate1p3Deployment.php new file mode 100644 index 0000000..87f49da --- /dev/null +++ b/src/Model/LtiConfigurationCreate1p3Deployment.php @@ -0,0 +1,562 @@ + + */ +class LtiConfigurationCreate1p3Deployment implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'LtiConfigurationCreate1p3Deployment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'mode' => 'string', + 'deployment_type' => 'string', + 'deployment_id' => 'string', + 'client_id' => 'string', + 'deployment_breakdown_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'mode' => null, + 'deployment_type' => null, + 'deployment_id' => null, + 'client_id' => null, + 'deployment_breakdown_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'mode' => false, + 'deployment_type' => false, + 'deployment_id' => false, + 'client_id' => false, + 'deployment_breakdown_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'mode' => 'mode', + 'deployment_type' => 'deploymentType', + 'deployment_id' => 'deploymentId', + 'client_id' => 'clientId', + 'deployment_breakdown_id' => 'deploymentBreakdownId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'mode' => 'setMode', + 'deployment_type' => 'setDeploymentType', + 'deployment_id' => 'setDeploymentId', + 'client_id' => 'setClientId', + 'deployment_breakdown_id' => 'setDeploymentBreakdownId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'mode' => 'getMode', + 'deployment_type' => 'getDeploymentType', + 'deployment_id' => 'getDeploymentId', + 'client_id' => 'getClientId', + 'deployment_breakdown_id' => 'getDeploymentBreakdownId' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const MODE__1P3_DEPLOYMENT = '1p3-deployment'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getModeAllowableValues() + { + return [ + self::MODE__1P3_DEPLOYMENT, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('mode', $data ?? [], null); + $this->setIfExists('deployment_type', $data ?? [], null); + $this->setIfExists('deployment_id', $data ?? [], null); + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('deployment_breakdown_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['mode'] === null) { + $invalidProperties[] = "'mode' can't be null"; + } + $allowedValues = self::getModeAllowableValues(); + if (!is_null($this->container['mode']) && !in_array($this->container['mode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'mode', must be one of '%s'", + $this->container['mode'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['deployment_type'] === null) { + $invalidProperties[] = "'deployment_type' can't be null"; + } + if ($this->container['deployment_id'] === null) { + $invalidProperties[] = "'deployment_id' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets mode + * + * @return string + */ + public function getMode(): string + { + return $this->container['mode']; + } + + /** + * Sets mode + * + * @param string $mode LTI 1.3 deployment-based creation mode + * + * @return $this + */ + public function setMode(string $mode): static + { + if (is_null($mode)) { + throw new InvalidArgumentException('non-nullable mode cannot be null'); + } + $allowedValues = self::getModeAllowableValues(); + if (!in_array($mode, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'mode', must be one of '%s'", + $mode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['mode'] = $mode; + + return $this; + } + + /** + * Gets deployment_type + * + * @return string + */ + public function getDeploymentType(): string + { + return $this->container['deployment_type']; + } + + /** + * Sets deployment_type + * + * @param string $deployment_type Parent platform key (e.g., canvas, blackboard, schoology, classlink) + * + * @return $this + */ + public function setDeploymentType(string $deployment_type): static + { + if (is_null($deployment_type)) { + throw new InvalidArgumentException('non-nullable deployment_type cannot be null'); + } + $this->container['deployment_type'] = $deployment_type; + + return $this; + } + + /** + * Gets deployment_id + * + * @return string + */ + public function getDeploymentId(): string + { + return $this->container['deployment_id']; + } + + /** + * Sets deployment_id + * + * @param string $deployment_id Deployment identifier provided by the platform + * + * @return $this + */ + public function setDeploymentId(string $deployment_id): static + { + if (is_null($deployment_id)) { + throw new InvalidArgumentException('non-nullable deployment_id cannot be null'); + } + $this->container['deployment_id'] = $deployment_id; + + return $this; + } + + /** + * Gets client_id + * + * @return string|null + */ + public function getClientId(): ?string + { + return $this->container['client_id']; + } + + /** + * Sets client_id + * + * @param string|null $client_id OAuth2 client_id for the tenant; required for ClassLink deployments + * + * @return $this + */ + public function setClientId(?string $client_id): static + { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } + $this->container['client_id'] = $client_id; + + return $this; + } + + /** + * Gets deployment_breakdown_id + * + * @return string|null + */ + public function getDeploymentBreakdownId(): ?string + { + return $this->container['deployment_breakdown_id']; + } + + /** + * Sets deployment_breakdown_id + * + * @param string|null $deployment_breakdown_id Value of the custom claim that identifies this specific tenant (for multi-tenant platforms like Schoology) + * + * @return $this + */ + public function setDeploymentBreakdownId(?string $deployment_breakdown_id): static + { + if (is_null($deployment_breakdown_id)) { + throw new InvalidArgumentException('non-nullable deployment_breakdown_id cannot be null'); + } + $this->container['deployment_breakdown_id'] = $deployment_breakdown_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LtiConfigurationCreate1p3Dynamic.php b/src/Model/LtiConfigurationCreate1p3Dynamic.php new file mode 100644 index 0000000..30ee788 --- /dev/null +++ b/src/Model/LtiConfigurationCreate1p3Dynamic.php @@ -0,0 +1,488 @@ + + */ +class LtiConfigurationCreate1p3Dynamic implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'LtiConfigurationCreate1p3Dynamic'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'mode' => 'string', + 'platform_info' => '\Flat\APIClient\Model\LtiConfigurationCreate1p3DynamicPlatformInfo', + 'locale' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'mode' => null, + 'platform_info' => null, + 'locale' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'mode' => false, + 'platform_info' => false, + 'locale' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'mode' => 'mode', + 'platform_info' => 'platformInfo', + 'locale' => 'locale' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'mode' => 'setMode', + 'platform_info' => 'setPlatformInfo', + 'locale' => 'setLocale' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'mode' => 'getMode', + 'platform_info' => 'getPlatformInfo', + 'locale' => 'getLocale' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const MODE__1P3_DYNAMIC = '1p3-dynamic'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getModeAllowableValues() + { + return [ + self::MODE__1P3_DYNAMIC, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('mode', $data ?? [], null); + $this->setIfExists('platform_info', $data ?? [], null); + $this->setIfExists('locale', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['mode'] === null) { + $invalidProperties[] = "'mode' can't be null"; + } + $allowedValues = self::getModeAllowableValues(); + if (!is_null($this->container['mode']) && !in_array($this->container['mode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'mode', must be one of '%s'", + $this->container['mode'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets mode + * + * @return string + */ + public function getMode(): string + { + return $this->container['mode']; + } + + /** + * Sets mode + * + * @param string $mode LTI 1.3 dynamic registration mode + * + * @return $this + */ + public function setMode(string $mode): static + { + if (is_null($mode)) { + throw new InvalidArgumentException('non-nullable mode cannot be null'); + } + $allowedValues = self::getModeAllowableValues(); + if (!in_array($mode, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'mode', must be one of '%s'", + $mode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['mode'] = $mode; + + return $this; + } + + /** + * Gets platform_info + * + * @return \Flat\APIClient\Model\LtiConfigurationCreate1p3DynamicPlatformInfo|null + */ + public function getPlatformInfo(): ?\Flat\APIClient\Model\LtiConfigurationCreate1p3DynamicPlatformInfo + { + return $this->container['platform_info']; + } + + /** + * Sets platform_info + * + * @param \Flat\APIClient\Model\LtiConfigurationCreate1p3DynamicPlatformInfo|null $platform_info platform_info + * + * @return $this + */ + public function setPlatformInfo(?\Flat\APIClient\Model\LtiConfigurationCreate1p3DynamicPlatformInfo $platform_info): static + { + if (is_null($platform_info)) { + throw new InvalidArgumentException('non-nullable platform_info cannot be null'); + } + $this->container['platform_info'] = $platform_info; + + return $this; + } + + /** + * Gets locale + * + * @return string|null + */ + public function getLocale(): ?string + { + return $this->container['locale']; + } + + /** + * Sets locale + * + * @param string|null $locale Optional locale code for registration URL. Input values will be automatically normalized to a supported locale code. + * + * @return $this + */ + public function setLocale(?string $locale): static + { + if (is_null($locale)) { + throw new InvalidArgumentException('non-nullable locale cannot be null'); + } + $this->container['locale'] = $locale; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LtiConfigurationCreate1p3DynamicPlatformInfo.php b/src/Model/LtiConfigurationCreate1p3DynamicPlatformInfo.php new file mode 100644 index 0000000..b08d2ca --- /dev/null +++ b/src/Model/LtiConfigurationCreate1p3DynamicPlatformInfo.php @@ -0,0 +1,419 @@ + + */ +class LtiConfigurationCreate1p3DynamicPlatformInfo implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'LtiConfigurationCreate1p3Dynamic_platformInfo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'url' => 'getUrl' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Platform display name + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl(): ?string + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url Optional platform homepage or admin URL for reference + * + * @return $this + */ + public function setUrl(?string $url): static + { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LtiConfigurationCreate1p3Manual.php b/src/Model/LtiConfigurationCreate1p3Manual.php new file mode 100644 index 0000000..b5b7125 --- /dev/null +++ b/src/Model/LtiConfigurationCreate1p3Manual.php @@ -0,0 +1,692 @@ + + */ +class LtiConfigurationCreate1p3Manual implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'LtiConfigurationCreate1p3Manual'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'mode' => 'string', + 'platform_iss' => 'string', + 'platform_name' => 'string', + 'client_id' => 'string', + 'deployment_id' => 'string', + 'access_token_url' => 'string', + 'authorization_url' => 'string', + 'jwks_url' => 'string', + 'enable_email_matching' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'mode' => null, + 'platform_iss' => null, + 'platform_name' => null, + 'client_id' => null, + 'deployment_id' => null, + 'access_token_url' => 'url', + 'authorization_url' => 'url', + 'jwks_url' => 'url', + 'enable_email_matching' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'mode' => false, + 'platform_iss' => false, + 'platform_name' => false, + 'client_id' => false, + 'deployment_id' => false, + 'access_token_url' => false, + 'authorization_url' => false, + 'jwks_url' => false, + 'enable_email_matching' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'mode' => 'mode', + 'platform_iss' => 'platformIss', + 'platform_name' => 'platformName', + 'client_id' => 'clientId', + 'deployment_id' => 'deploymentId', + 'access_token_url' => 'accessTokenUrl', + 'authorization_url' => 'authorizationUrl', + 'jwks_url' => 'jwksUrl', + 'enable_email_matching' => 'enableEmailMatching' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'mode' => 'setMode', + 'platform_iss' => 'setPlatformIss', + 'platform_name' => 'setPlatformName', + 'client_id' => 'setClientId', + 'deployment_id' => 'setDeploymentId', + 'access_token_url' => 'setAccessTokenUrl', + 'authorization_url' => 'setAuthorizationUrl', + 'jwks_url' => 'setJwksUrl', + 'enable_email_matching' => 'setEnableEmailMatching' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'mode' => 'getMode', + 'platform_iss' => 'getPlatformIss', + 'platform_name' => 'getPlatformName', + 'client_id' => 'getClientId', + 'deployment_id' => 'getDeploymentId', + 'access_token_url' => 'getAccessTokenUrl', + 'authorization_url' => 'getAuthorizationUrl', + 'jwks_url' => 'getJwksUrl', + 'enable_email_matching' => 'getEnableEmailMatching' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const MODE__1P3_MANUAL = '1p3-manual'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getModeAllowableValues() + { + return [ + self::MODE__1P3_MANUAL, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('mode', $data ?? [], null); + $this->setIfExists('platform_iss', $data ?? [], null); + $this->setIfExists('platform_name', $data ?? [], null); + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('deployment_id', $data ?? [], null); + $this->setIfExists('access_token_url', $data ?? [], null); + $this->setIfExists('authorization_url', $data ?? [], null); + $this->setIfExists('jwks_url', $data ?? [], null); + $this->setIfExists('enable_email_matching', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['mode'] === null) { + $invalidProperties[] = "'mode' can't be null"; + } + $allowedValues = self::getModeAllowableValues(); + if (!is_null($this->container['mode']) && !in_array($this->container['mode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'mode', must be one of '%s'", + $this->container['mode'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets mode + * + * @return string + */ + public function getMode(): string + { + return $this->container['mode']; + } + + /** + * Sets mode + * + * @param string $mode LTI 1.3 manual creation mode + * + * @return $this + */ + public function setMode(string $mode): static + { + if (is_null($mode)) { + throw new InvalidArgumentException('non-nullable mode cannot be null'); + } + $allowedValues = self::getModeAllowableValues(); + if (!in_array($mode, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'mode', must be one of '%s'", + $mode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['mode'] = $mode; + + return $this; + } + + /** + * Gets platform_iss + * + * @return string|null + */ + public function getPlatformIss(): ?string + { + return $this->container['platform_iss']; + } + + /** + * Sets platform_iss + * + * @param string|null $platform_iss Platform issuer URL + * + * @return $this + */ + public function setPlatformIss(?string $platform_iss): static + { + if (is_null($platform_iss)) { + throw new InvalidArgumentException('non-nullable platform_iss cannot be null'); + } + $this->container['platform_iss'] = $platform_iss; + + return $this; + } + + /** + * Gets platform_name + * + * @return string|null + */ + public function getPlatformName(): ?string + { + return $this->container['platform_name']; + } + + /** + * Sets platform_name + * + * @param string|null $platform_name Platform display name + * + * @return $this + */ + public function setPlatformName(?string $platform_name): static + { + if (is_null($platform_name)) { + throw new InvalidArgumentException('non-nullable platform_name cannot be null'); + } + $this->container['platform_name'] = $platform_name; + + return $this; + } + + /** + * Gets client_id + * + * @return string|null + */ + public function getClientId(): ?string + { + return $this->container['client_id']; + } + + /** + * Sets client_id + * + * @param string|null $client_id OAuth2 client_id allocated by the platform + * + * @return $this + */ + public function setClientId(?string $client_id): static + { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } + $this->container['client_id'] = $client_id; + + return $this; + } + + /** + * Gets deployment_id + * + * @return string|null + */ + public function getDeploymentId(): ?string + { + return $this->container['deployment_id']; + } + + /** + * Sets deployment_id + * + * @param string|null $deployment_id Deployment identifier provided by the platform + * + * @return $this + */ + public function setDeploymentId(?string $deployment_id): static + { + if (is_null($deployment_id)) { + throw new InvalidArgumentException('non-nullable deployment_id cannot be null'); + } + $this->container['deployment_id'] = $deployment_id; + + return $this; + } + + /** + * Gets access_token_url + * + * @return string|null + */ + public function getAccessTokenUrl(): ?string + { + return $this->container['access_token_url']; + } + + /** + * Sets access_token_url + * + * @param string|null $access_token_url Platform access token endpoint URL + * + * @return $this + */ + public function setAccessTokenUrl(?string $access_token_url): static + { + if (is_null($access_token_url)) { + throw new InvalidArgumentException('non-nullable access_token_url cannot be null'); + } + $this->container['access_token_url'] = $access_token_url; + + return $this; + } + + /** + * Gets authorization_url + * + * @return string|null + */ + public function getAuthorizationUrl(): ?string + { + return $this->container['authorization_url']; + } + + /** + * Sets authorization_url + * + * @param string|null $authorization_url Platform OIDC authorization endpoint URL + * + * @return $this + */ + public function setAuthorizationUrl(?string $authorization_url): static + { + if (is_null($authorization_url)) { + throw new InvalidArgumentException('non-nullable authorization_url cannot be null'); + } + $this->container['authorization_url'] = $authorization_url; + + return $this; + } + + /** + * Gets jwks_url + * + * @return string|null + */ + public function getJwksUrl(): ?string + { + return $this->container['jwks_url']; + } + + /** + * Sets jwks_url + * + * @param string|null $jwks_url Platform JWKS endpoint URL for public keys + * + * @return $this + */ + public function setJwksUrl(?string $jwks_url): static + { + if (is_null($jwks_url)) { + throw new InvalidArgumentException('non-nullable jwks_url cannot be null'); + } + $this->container['jwks_url'] = $jwks_url; + + return $this; + } + + /** + * Gets enable_email_matching + * + * @return bool|null + */ + public function getEnableEmailMatching(): ?bool + { + return $this->container['enable_email_matching']; + } + + /** + * Sets enable_email_matching + * + * @param bool|null $enable_email_matching Enable email-based user matching during LTI authentication + * + * @return $this + */ + public function setEnableEmailMatching(?bool $enable_email_matching): static + { + if (is_null($enable_email_matching)) { + throw new InvalidArgumentException('non-nullable enable_email_matching cannot be null'); + } + $this->container['enable_email_matching'] = $enable_email_matching; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LtiConfigurationUpdate.php b/src/Model/LtiConfigurationUpdate.php new file mode 100644 index 0000000..e9825eb --- /dev/null +++ b/src/Model/LtiConfigurationUpdate.php @@ -0,0 +1,657 @@ + + */ +class LtiConfigurationUpdate implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'LtiConfigurationUpdate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'deployment_id' => 'string', + 'deployment_breakdown_id' => 'string', + 'enable_email_matching' => 'bool', + 'platform_iss' => 'string', + 'platform_name' => 'string', + 'client_id' => 'string', + 'access_token_url' => 'string', + 'authorization_url' => 'string', + 'jwks_url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'deployment_id' => null, + 'deployment_breakdown_id' => null, + 'enable_email_matching' => null, + 'platform_iss' => null, + 'platform_name' => null, + 'client_id' => null, + 'access_token_url' => 'url', + 'authorization_url' => 'url', + 'jwks_url' => 'url' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'deployment_id' => false, + 'deployment_breakdown_id' => false, + 'enable_email_matching' => false, + 'platform_iss' => false, + 'platform_name' => false, + 'client_id' => false, + 'access_token_url' => false, + 'authorization_url' => false, + 'jwks_url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'deployment_id' => 'deploymentId', + 'deployment_breakdown_id' => 'deploymentBreakdownId', + 'enable_email_matching' => 'enableEmailMatching', + 'platform_iss' => 'platformIss', + 'platform_name' => 'platformName', + 'client_id' => 'clientId', + 'access_token_url' => 'accessTokenUrl', + 'authorization_url' => 'authorizationUrl', + 'jwks_url' => 'jwksUrl' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'deployment_id' => 'setDeploymentId', + 'deployment_breakdown_id' => 'setDeploymentBreakdownId', + 'enable_email_matching' => 'setEnableEmailMatching', + 'platform_iss' => 'setPlatformIss', + 'platform_name' => 'setPlatformName', + 'client_id' => 'setClientId', + 'access_token_url' => 'setAccessTokenUrl', + 'authorization_url' => 'setAuthorizationUrl', + 'jwks_url' => 'setJwksUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'deployment_id' => 'getDeploymentId', + 'deployment_breakdown_id' => 'getDeploymentBreakdownId', + 'enable_email_matching' => 'getEnableEmailMatching', + 'platform_iss' => 'getPlatformIss', + 'platform_name' => 'getPlatformName', + 'client_id' => 'getClientId', + 'access_token_url' => 'getAccessTokenUrl', + 'authorization_url' => 'getAuthorizationUrl', + 'jwks_url' => 'getJwksUrl' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('deployment_id', $data ?? [], null); + $this->setIfExists('deployment_breakdown_id', $data ?? [], null); + $this->setIfExists('enable_email_matching', $data ?? [], null); + $this->setIfExists('platform_iss', $data ?? [], null); + $this->setIfExists('platform_name', $data ?? [], null); + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('access_token_url', $data ?? [], null); + $this->setIfExists('authorization_url', $data ?? [], null); + $this->setIfExists('jwks_url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets deployment_id + * + * @return string|null + */ + public function getDeploymentId(): ?string + { + return $this->container['deployment_id']; + } + + /** + * Sets deployment_id + * + * @param string|null $deployment_id Deployment identifier provided by the platform + * + * @return $this + */ + public function setDeploymentId(?string $deployment_id): static + { + if (is_null($deployment_id)) { + throw new InvalidArgumentException('non-nullable deployment_id cannot be null'); + } + $this->container['deployment_id'] = $deployment_id; + + return $this; + } + + /** + * Gets deployment_breakdown_id + * + * @return string|null + */ + public function getDeploymentBreakdownId(): ?string + { + return $this->container['deployment_breakdown_id']; + } + + /** + * Sets deployment_breakdown_id + * + * @param string|null $deployment_breakdown_id Specific tenant identifier for multi-tenant platforms + * + * @return $this + */ + public function setDeploymentBreakdownId(?string $deployment_breakdown_id): static + { + if (is_null($deployment_breakdown_id)) { + throw new InvalidArgumentException('non-nullable deployment_breakdown_id cannot be null'); + } + $this->container['deployment_breakdown_id'] = $deployment_breakdown_id; + + return $this; + } + + /** + * Gets enable_email_matching + * + * @return bool|null + */ + public function getEnableEmailMatching(): ?bool + { + return $this->container['enable_email_matching']; + } + + /** + * Sets enable_email_matching + * + * @param bool|null $enable_email_matching Enable email-based user matching during LTI authentication + * + * @return $this + */ + public function setEnableEmailMatching(?bool $enable_email_matching): static + { + if (is_null($enable_email_matching)) { + throw new InvalidArgumentException('non-nullable enable_email_matching cannot be null'); + } + $this->container['enable_email_matching'] = $enable_email_matching; + + return $this; + } + + /** + * Gets platform_iss + * + * @return string|null + */ + public function getPlatformIss(): ?string + { + return $this->container['platform_iss']; + } + + /** + * Sets platform_iss + * + * @param string|null $platform_iss Platform issuer URL + * + * @return $this + */ + public function setPlatformIss(?string $platform_iss): static + { + if (is_null($platform_iss)) { + throw new InvalidArgumentException('non-nullable platform_iss cannot be null'); + } + $this->container['platform_iss'] = $platform_iss; + + return $this; + } + + /** + * Gets platform_name + * + * @return string|null + */ + public function getPlatformName(): ?string + { + return $this->container['platform_name']; + } + + /** + * Sets platform_name + * + * @param string|null $platform_name Platform display name + * + * @return $this + */ + public function setPlatformName(?string $platform_name): static + { + if (is_null($platform_name)) { + throw new InvalidArgumentException('non-nullable platform_name cannot be null'); + } + $this->container['platform_name'] = $platform_name; + + return $this; + } + + /** + * Gets client_id + * + * @return string|null + */ + public function getClientId(): ?string + { + return $this->container['client_id']; + } + + /** + * Sets client_id + * + * @param string|null $client_id OAuth2 client_id allocated by the platform + * + * @return $this + */ + public function setClientId(?string $client_id): static + { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } + $this->container['client_id'] = $client_id; + + return $this; + } + + /** + * Gets access_token_url + * + * @return string|null + */ + public function getAccessTokenUrl(): ?string + { + return $this->container['access_token_url']; + } + + /** + * Sets access_token_url + * + * @param string|null $access_token_url Platform access token endpoint URL + * + * @return $this + */ + public function setAccessTokenUrl(?string $access_token_url): static + { + if (is_null($access_token_url)) { + throw new InvalidArgumentException('non-nullable access_token_url cannot be null'); + } + $this->container['access_token_url'] = $access_token_url; + + return $this; + } + + /** + * Gets authorization_url + * + * @return string|null + */ + public function getAuthorizationUrl(): ?string + { + return $this->container['authorization_url']; + } + + /** + * Sets authorization_url + * + * @param string|null $authorization_url Platform OIDC authorization endpoint URL + * + * @return $this + */ + public function setAuthorizationUrl(?string $authorization_url): static + { + if (is_null($authorization_url)) { + throw new InvalidArgumentException('non-nullable authorization_url cannot be null'); + } + $this->container['authorization_url'] = $authorization_url; + + return $this; + } + + /** + * Gets jwks_url + * + * @return string|null + */ + public function getJwksUrl(): ?string + { + return $this->container['jwks_url']; + } + + /** + * Sets jwks_url + * + * @param string|null $jwks_url Platform JWKS endpoint URL for public keys + * + * @return $this + */ + public function setJwksUrl(?string $jwks_url): static + { + if (is_null($jwks_url)) { + throw new InvalidArgumentException('non-nullable jwks_url cannot be null'); + } + $this->container['jwks_url'] = $jwks_url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LtiConfigurationUpdateDeployment.php b/src/Model/LtiConfigurationUpdateDeployment.php new file mode 100644 index 0000000..fa9c34c --- /dev/null +++ b/src/Model/LtiConfigurationUpdateDeployment.php @@ -0,0 +1,453 @@ + + */ +class LtiConfigurationUpdateDeployment implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'LtiConfigurationUpdateDeployment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'deployment_id' => 'string', + 'deployment_breakdown_id' => 'string', + 'enable_email_matching' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'deployment_id' => null, + 'deployment_breakdown_id' => null, + 'enable_email_matching' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'deployment_id' => false, + 'deployment_breakdown_id' => false, + 'enable_email_matching' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'deployment_id' => 'deploymentId', + 'deployment_breakdown_id' => 'deploymentBreakdownId', + 'enable_email_matching' => 'enableEmailMatching' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'deployment_id' => 'setDeploymentId', + 'deployment_breakdown_id' => 'setDeploymentBreakdownId', + 'enable_email_matching' => 'setEnableEmailMatching' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'deployment_id' => 'getDeploymentId', + 'deployment_breakdown_id' => 'getDeploymentBreakdownId', + 'enable_email_matching' => 'getEnableEmailMatching' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('deployment_id', $data ?? [], null); + $this->setIfExists('deployment_breakdown_id', $data ?? [], null); + $this->setIfExists('enable_email_matching', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets deployment_id + * + * @return string|null + */ + public function getDeploymentId(): ?string + { + return $this->container['deployment_id']; + } + + /** + * Sets deployment_id + * + * @param string|null $deployment_id Deployment identifier provided by the platform + * + * @return $this + */ + public function setDeploymentId(?string $deployment_id): static + { + if (is_null($deployment_id)) { + throw new InvalidArgumentException('non-nullable deployment_id cannot be null'); + } + $this->container['deployment_id'] = $deployment_id; + + return $this; + } + + /** + * Gets deployment_breakdown_id + * + * @return string|null + */ + public function getDeploymentBreakdownId(): ?string + { + return $this->container['deployment_breakdown_id']; + } + + /** + * Sets deployment_breakdown_id + * + * @param string|null $deployment_breakdown_id Specific tenant identifier for multi-tenant platforms + * + * @return $this + */ + public function setDeploymentBreakdownId(?string $deployment_breakdown_id): static + { + if (is_null($deployment_breakdown_id)) { + throw new InvalidArgumentException('non-nullable deployment_breakdown_id cannot be null'); + } + $this->container['deployment_breakdown_id'] = $deployment_breakdown_id; + + return $this; + } + + /** + * Gets enable_email_matching + * + * @return bool|null + */ + public function getEnableEmailMatching(): ?bool + { + return $this->container['enable_email_matching']; + } + + /** + * Sets enable_email_matching + * + * @param bool|null $enable_email_matching Enable email-based user matching during LTI authentication + * + * @return $this + */ + public function setEnableEmailMatching(?bool $enable_email_matching): static + { + if (is_null($enable_email_matching)) { + throw new InvalidArgumentException('non-nullable enable_email_matching cannot be null'); + } + $this->container['enable_email_matching'] = $enable_email_matching; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LtiConfigurationUpdateStandalone.php b/src/Model/LtiConfigurationUpdateStandalone.php new file mode 100644 index 0000000..027dcf3 --- /dev/null +++ b/src/Model/LtiConfigurationUpdateStandalone.php @@ -0,0 +1,623 @@ + + */ +class LtiConfigurationUpdateStandalone implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'LtiConfigurationUpdateStandalone'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'deployment_id' => 'string', + 'platform_iss' => 'string', + 'platform_name' => 'string', + 'client_id' => 'string', + 'access_token_url' => 'string', + 'authorization_url' => 'string', + 'jwks_url' => 'string', + 'enable_email_matching' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'deployment_id' => null, + 'platform_iss' => null, + 'platform_name' => null, + 'client_id' => null, + 'access_token_url' => 'url', + 'authorization_url' => 'url', + 'jwks_url' => 'url', + 'enable_email_matching' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'deployment_id' => false, + 'platform_iss' => false, + 'platform_name' => false, + 'client_id' => false, + 'access_token_url' => false, + 'authorization_url' => false, + 'jwks_url' => false, + 'enable_email_matching' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'deployment_id' => 'deploymentId', + 'platform_iss' => 'platformIss', + 'platform_name' => 'platformName', + 'client_id' => 'clientId', + 'access_token_url' => 'accessTokenUrl', + 'authorization_url' => 'authorizationUrl', + 'jwks_url' => 'jwksUrl', + 'enable_email_matching' => 'enableEmailMatching' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'deployment_id' => 'setDeploymentId', + 'platform_iss' => 'setPlatformIss', + 'platform_name' => 'setPlatformName', + 'client_id' => 'setClientId', + 'access_token_url' => 'setAccessTokenUrl', + 'authorization_url' => 'setAuthorizationUrl', + 'jwks_url' => 'setJwksUrl', + 'enable_email_matching' => 'setEnableEmailMatching' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'deployment_id' => 'getDeploymentId', + 'platform_iss' => 'getPlatformIss', + 'platform_name' => 'getPlatformName', + 'client_id' => 'getClientId', + 'access_token_url' => 'getAccessTokenUrl', + 'authorization_url' => 'getAuthorizationUrl', + 'jwks_url' => 'getJwksUrl', + 'enable_email_matching' => 'getEnableEmailMatching' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('deployment_id', $data ?? [], null); + $this->setIfExists('platform_iss', $data ?? [], null); + $this->setIfExists('platform_name', $data ?? [], null); + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('access_token_url', $data ?? [], null); + $this->setIfExists('authorization_url', $data ?? [], null); + $this->setIfExists('jwks_url', $data ?? [], null); + $this->setIfExists('enable_email_matching', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets deployment_id + * + * @return string|null + */ + public function getDeploymentId(): ?string + { + return $this->container['deployment_id']; + } + + /** + * Sets deployment_id + * + * @param string|null $deployment_id Deployment identifier provided by the platform + * + * @return $this + */ + public function setDeploymentId(?string $deployment_id): static + { + if (is_null($deployment_id)) { + throw new InvalidArgumentException('non-nullable deployment_id cannot be null'); + } + $this->container['deployment_id'] = $deployment_id; + + return $this; + } + + /** + * Gets platform_iss + * + * @return string|null + */ + public function getPlatformIss(): ?string + { + return $this->container['platform_iss']; + } + + /** + * Sets platform_iss + * + * @param string|null $platform_iss Platform issuer URL + * + * @return $this + */ + public function setPlatformIss(?string $platform_iss): static + { + if (is_null($platform_iss)) { + throw new InvalidArgumentException('non-nullable platform_iss cannot be null'); + } + $this->container['platform_iss'] = $platform_iss; + + return $this; + } + + /** + * Gets platform_name + * + * @return string|null + */ + public function getPlatformName(): ?string + { + return $this->container['platform_name']; + } + + /** + * Sets platform_name + * + * @param string|null $platform_name Platform display name + * + * @return $this + */ + public function setPlatformName(?string $platform_name): static + { + if (is_null($platform_name)) { + throw new InvalidArgumentException('non-nullable platform_name cannot be null'); + } + $this->container['platform_name'] = $platform_name; + + return $this; + } + + /** + * Gets client_id + * + * @return string|null + */ + public function getClientId(): ?string + { + return $this->container['client_id']; + } + + /** + * Sets client_id + * + * @param string|null $client_id OAuth2 client_id allocated by the platform + * + * @return $this + */ + public function setClientId(?string $client_id): static + { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } + $this->container['client_id'] = $client_id; + + return $this; + } + + /** + * Gets access_token_url + * + * @return string|null + */ + public function getAccessTokenUrl(): ?string + { + return $this->container['access_token_url']; + } + + /** + * Sets access_token_url + * + * @param string|null $access_token_url Platform access token endpoint URL + * + * @return $this + */ + public function setAccessTokenUrl(?string $access_token_url): static + { + if (is_null($access_token_url)) { + throw new InvalidArgumentException('non-nullable access_token_url cannot be null'); + } + $this->container['access_token_url'] = $access_token_url; + + return $this; + } + + /** + * Gets authorization_url + * + * @return string|null + */ + public function getAuthorizationUrl(): ?string + { + return $this->container['authorization_url']; + } + + /** + * Sets authorization_url + * + * @param string|null $authorization_url Platform OIDC authorization endpoint URL + * + * @return $this + */ + public function setAuthorizationUrl(?string $authorization_url): static + { + if (is_null($authorization_url)) { + throw new InvalidArgumentException('non-nullable authorization_url cannot be null'); + } + $this->container['authorization_url'] = $authorization_url; + + return $this; + } + + /** + * Gets jwks_url + * + * @return string|null + */ + public function getJwksUrl(): ?string + { + return $this->container['jwks_url']; + } + + /** + * Sets jwks_url + * + * @param string|null $jwks_url Platform JWKS endpoint URL for public keys + * + * @return $this + */ + public function setJwksUrl(?string $jwks_url): static + { + if (is_null($jwks_url)) { + throw new InvalidArgumentException('non-nullable jwks_url cannot be null'); + } + $this->container['jwks_url'] = $jwks_url; + + return $this; + } + + /** + * Gets enable_email_matching + * + * @return bool|null + */ + public function getEnableEmailMatching(): ?bool + { + return $this->container['enable_email_matching']; + } + + /** + * Sets enable_email_matching + * + * @param bool|null $enable_email_matching Enable email-based user matching during LTI authentication + * + * @return $this + */ + public function setEnableEmailMatching(?bool $enable_email_matching): static + { + if (is_null($enable_email_matching)) { + throw new InvalidArgumentException('non-nullable enable_email_matching cannot be null'); + } + $this->container['enable_email_matching'] = $enable_email_matching; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LtiCredentials.php b/src/Model/LtiCredentials.php new file mode 100644 index 0000000..3f0e3e1 --- /dev/null +++ b/src/Model/LtiCredentials.php @@ -0,0 +1,691 @@ + + */ +class LtiCredentials implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'LtiCredentials'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'lms' => '\Flat\APIClient\Model\LmsName', + 'organization' => 'string', + 'creator' => 'string', + 'creation_date' => '\DateTime', + 'last_usage' => '\DateTime', + 'consumer_key' => 'string', + 'consumer_secret' => 'string', + 'enable_email_matching' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'lms' => null, + 'organization' => null, + 'creator' => null, + 'creation_date' => 'date-time', + 'last_usage' => 'date-time', + 'consumer_key' => null, + 'consumer_secret' => null, + 'enable_email_matching' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'lms' => false, + 'organization' => false, + 'creator' => false, + 'creation_date' => false, + 'last_usage' => false, + 'consumer_key' => false, + 'consumer_secret' => false, + 'enable_email_matching' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'lms' => 'lms', + 'organization' => 'organization', + 'creator' => 'creator', + 'creation_date' => 'creationDate', + 'last_usage' => 'lastUsage', + 'consumer_key' => 'consumerKey', + 'consumer_secret' => 'consumerSecret', + 'enable_email_matching' => 'enableEmailMatching' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'lms' => 'setLms', + 'organization' => 'setOrganization', + 'creator' => 'setCreator', + 'creation_date' => 'setCreationDate', + 'last_usage' => 'setLastUsage', + 'consumer_key' => 'setConsumerKey', + 'consumer_secret' => 'setConsumerSecret', + 'enable_email_matching' => 'setEnableEmailMatching' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'lms' => 'getLms', + 'organization' => 'getOrganization', + 'creator' => 'getCreator', + 'creation_date' => 'getCreationDate', + 'last_usage' => 'getLastUsage', + 'consumer_key' => 'getConsumerKey', + 'consumer_secret' => 'getConsumerSecret', + 'enable_email_matching' => 'getEnableEmailMatching' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('lms', $data ?? [], null); + $this->setIfExists('organization', $data ?? [], null); + $this->setIfExists('creator', $data ?? [], null); + $this->setIfExists('creation_date', $data ?? [], null); + $this->setIfExists('last_usage', $data ?? [], null); + $this->setIfExists('consumer_key', $data ?? [], null); + $this->setIfExists('consumer_secret', $data ?? [], null); + $this->setIfExists('enable_email_matching', $data ?? [], true); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The unique identifier of this couple of credentials + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the couple of credentials + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets lms + * + * @return \Flat\APIClient\Model\LmsName|null + */ + public function getLms(): ?\Flat\APIClient\Model\LmsName + { + return $this->container['lms']; + } + + /** + * Sets lms + * + * @param \Flat\APIClient\Model\LmsName|null $lms lms + * + * @return $this + */ + public function setLms(?\Flat\APIClient\Model\LmsName $lms): static + { + if (is_null($lms)) { + throw new InvalidArgumentException('non-nullable lms cannot be null'); + } + $this->container['lms'] = $lms; + + return $this; + } + + /** + * Gets organization + * + * @return string|null + */ + public function getOrganization(): ?string + { + return $this->container['organization']; + } + + /** + * Sets organization + * + * @param string|null $organization The unique identifier of the Organization associated to these credentials + * + * @return $this + */ + public function setOrganization(?string $organization): static + { + if (is_null($organization)) { + throw new InvalidArgumentException('non-nullable organization cannot be null'); + } + $this->container['organization'] = $organization; + + return $this; + } + + /** + * Gets creator + * + * @return string|null + */ + public function getCreator(): ?string + { + return $this->container['creator']; + } + + /** + * Sets creator + * + * @param string|null $creator Unique identifier of the user who created these credentials + * + * @return $this + */ + public function setCreator(?string $creator): static + { + if (is_null($creator)) { + throw new InvalidArgumentException('non-nullable creator cannot be null'); + } + $this->container['creator'] = $creator; + + return $this; + } + + /** + * Gets creation_date + * + * @return \DateTime|null + */ + public function getCreationDate(): ?\DateTime + { + return $this->container['creation_date']; + } + + /** + * Sets creation_date + * + * @param \DateTime|null $creation_date The creation date of thse credentials + * + * @return $this + */ + public function setCreationDate(?\DateTime $creation_date): static + { + if (is_null($creation_date)) { + throw new InvalidArgumentException('non-nullable creation_date cannot be null'); + } + $this->container['creation_date'] = $creation_date; + + return $this; + } + + /** + * Gets last_usage + * + * @return \DateTime|null + */ + public function getLastUsage(): ?\DateTime + { + return $this->container['last_usage']; + } + + /** + * Sets last_usage + * + * @param \DateTime|null $last_usage The last time these credentials were used + * + * @return $this + */ + public function setLastUsage(?\DateTime $last_usage): static + { + if (is_null($last_usage)) { + throw new InvalidArgumentException('non-nullable last_usage cannot be null'); + } + $this->container['last_usage'] = $last_usage; + + return $this; + } + + /** + * Gets consumer_key + * + * @return string|null + */ + public function getConsumerKey(): ?string + { + return $this->container['consumer_key']; + } + + /** + * Sets consumer_key + * + * @param string|null $consumer_key OAuth 1 Consumer Key + * + * @return $this + */ + public function setConsumerKey(?string $consumer_key): static + { + if (is_null($consumer_key)) { + throw new InvalidArgumentException('non-nullable consumer_key cannot be null'); + } + $this->container['consumer_key'] = $consumer_key; + + return $this; + } + + /** + * Gets consumer_secret + * + * @return string|null + */ + public function getConsumerSecret(): ?string + { + return $this->container['consumer_secret']; + } + + /** + * Sets consumer_secret + * + * @param string|null $consumer_secret OAuth 1 Consumer Secret + * + * @return $this + */ + public function setConsumerSecret(?string $consumer_secret): static + { + if (is_null($consumer_secret)) { + throw new InvalidArgumentException('non-nullable consumer_secret cannot be null'); + } + $this->container['consumer_secret'] = $consumer_secret; + + return $this; + } + + /** + * Gets enable_email_matching + * + * @return bool|null + */ + public function getEnableEmailMatching(): ?bool + { + return $this->container['enable_email_matching']; + } + + /** + * Sets enable_email_matching + * + * @param bool|null $enable_email_matching Enable email-based user matching during LTI authentication. When true (default): If a user with the same email exists in the organization, they will be matched and logged in instead of creating a new account. When false: Email matching is disabled. Only LTI ID matching is used, which means multiple LTI users can share the same email address and have separate Flat accounts. This is useful for cases like siblings sharing a parent email in the LMS. + * + * @return $this + */ + public function setEnableEmailMatching(?bool $enable_email_matching): static + { + if (is_null($enable_email_matching)) { + throw new InvalidArgumentException('non-nullable enable_email_matching cannot be null'); + } + $this->container['enable_email_matching'] = $enable_email_matching; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LtiCredentialsCreation.php b/src/Model/LtiCredentialsCreation.php new file mode 100644 index 0000000..1fbcb39 --- /dev/null +++ b/src/Model/LtiCredentialsCreation.php @@ -0,0 +1,433 @@ + + */ +class LtiCredentialsCreation implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'LtiCredentialsCreation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'lms' => '\Flat\APIClient\Model\LmsName' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'lms' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'lms' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'lms' => 'lms' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'lms' => 'setLms' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'lms' => 'getLms' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('lms', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ((mb_strlen($this->container['name']) > 300)) { + $invalidProperties[] = "invalid value for 'name', the character length must be smaller than or equal to 300."; + } + + if ($this->container['lms'] === null) { + $invalidProperties[] = "'lms' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName(): string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Name of the couple of credentials + * + * @return $this + */ + public function setName(string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + if ((mb_strlen($name) > 300)) { + throw new InvalidArgumentException('invalid length for $name when calling LtiCredentialsCreation., must be smaller than or equal to 300.'); + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets lms + * + * @return \Flat\APIClient\Model\LmsName + */ + public function getLms(): \Flat\APIClient\Model\LmsName + { + return $this->container['lms']; + } + + /** + * Sets lms + * + * @param \Flat\APIClient\Model\LmsName $lms lms + * + * @return $this + */ + public function setLms(\Flat\APIClient\Model\LmsName $lms): static + { + if (is_null($lms)) { + throw new InvalidArgumentException('non-nullable lms cannot be null'); + } + $this->container['lms'] = $lms; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MediaAttachment.php b/src/Model/MediaAttachment.php new file mode 100644 index 0000000..6b224b3 --- /dev/null +++ b/src/Model/MediaAttachment.php @@ -0,0 +1,1214 @@ + + */ +class MediaAttachment implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'MediaAttachment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => 'string', + 'score' => 'string', + 'revision' => 'string', + 'worksheet' => 'string', + 'dedicated' => 'bool', + 'track' => 'string', + 'part_uuid' => 'string', + 'sharing_mode' => '\Flat\APIClient\Model\MediaScoreSharingMode', + 'lock_score_template' => 'bool', + 'title' => 'string', + 'description' => 'string', + 'html' => 'string', + 'html_width' => 'float', + 'html_height' => 'float', + 'url' => 'string', + 'thumbnail_url' => 'string', + 'thumbnail_width' => 'int', + 'thumbnail_height' => 'int', + 'author_name' => 'string', + 'author_url' => 'string', + 'icon_url' => 'string', + 'mime_type' => 'string', + 'google_drive_file_id' => 'string', + 'teacher_only' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'score' => null, + 'revision' => null, + 'worksheet' => null, + 'dedicated' => null, + 'track' => null, + 'part_uuid' => null, + 'sharing_mode' => null, + 'lock_score_template' => null, + 'title' => null, + 'description' => null, + 'html' => null, + 'html_width' => null, + 'html_height' => null, + 'url' => null, + 'thumbnail_url' => null, + 'thumbnail_width' => null, + 'thumbnail_height' => null, + 'author_name' => null, + 'author_url' => null, + 'icon_url' => null, + 'mime_type' => null, + 'google_drive_file_id' => null, + 'teacher_only' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'score' => false, + 'revision' => false, + 'worksheet' => false, + 'dedicated' => false, + 'track' => false, + 'part_uuid' => false, + 'sharing_mode' => false, + 'lock_score_template' => false, + 'title' => false, + 'description' => false, + 'html' => false, + 'html_width' => false, + 'html_height' => false, + 'url' => false, + 'thumbnail_url' => false, + 'thumbnail_width' => false, + 'thumbnail_height' => false, + 'author_name' => false, + 'author_url' => false, + 'icon_url' => false, + 'mime_type' => false, + 'google_drive_file_id' => false, + 'teacher_only' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'score' => 'score', + 'revision' => 'revision', + 'worksheet' => 'worksheet', + 'dedicated' => 'dedicated', + 'track' => 'track', + 'part_uuid' => 'partUuid', + 'sharing_mode' => 'sharingMode', + 'lock_score_template' => 'lockScoreTemplate', + 'title' => 'title', + 'description' => 'description', + 'html' => 'html', + 'html_width' => 'htmlWidth', + 'html_height' => 'htmlHeight', + 'url' => 'url', + 'thumbnail_url' => 'thumbnailUrl', + 'thumbnail_width' => 'thumbnailWidth', + 'thumbnail_height' => 'thumbnailHeight', + 'author_name' => 'authorName', + 'author_url' => 'authorUrl', + 'icon_url' => 'iconUrl', + 'mime_type' => 'mimeType', + 'google_drive_file_id' => 'googleDriveFileId', + 'teacher_only' => 'teacherOnly' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'score' => 'setScore', + 'revision' => 'setRevision', + 'worksheet' => 'setWorksheet', + 'dedicated' => 'setDedicated', + 'track' => 'setTrack', + 'part_uuid' => 'setPartUuid', + 'sharing_mode' => 'setSharingMode', + 'lock_score_template' => 'setLockScoreTemplate', + 'title' => 'setTitle', + 'description' => 'setDescription', + 'html' => 'setHtml', + 'html_width' => 'setHtmlWidth', + 'html_height' => 'setHtmlHeight', + 'url' => 'setUrl', + 'thumbnail_url' => 'setThumbnailUrl', + 'thumbnail_width' => 'setThumbnailWidth', + 'thumbnail_height' => 'setThumbnailHeight', + 'author_name' => 'setAuthorName', + 'author_url' => 'setAuthorUrl', + 'icon_url' => 'setIconUrl', + 'mime_type' => 'setMimeType', + 'google_drive_file_id' => 'setGoogleDriveFileId', + 'teacher_only' => 'setTeacherOnly' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'score' => 'getScore', + 'revision' => 'getRevision', + 'worksheet' => 'getWorksheet', + 'dedicated' => 'getDedicated', + 'track' => 'getTrack', + 'part_uuid' => 'getPartUuid', + 'sharing_mode' => 'getSharingMode', + 'lock_score_template' => 'getLockScoreTemplate', + 'title' => 'getTitle', + 'description' => 'getDescription', + 'html' => 'getHtml', + 'html_width' => 'getHtmlWidth', + 'html_height' => 'getHtmlHeight', + 'url' => 'getUrl', + 'thumbnail_url' => 'getThumbnailUrl', + 'thumbnail_width' => 'getThumbnailWidth', + 'thumbnail_height' => 'getThumbnailHeight', + 'author_name' => 'getAuthorName', + 'author_url' => 'getAuthorUrl', + 'icon_url' => 'getIconUrl', + 'mime_type' => 'getMimeType', + 'google_drive_file_id' => 'getGoogleDriveFileId', + 'teacher_only' => 'getTeacherOnly' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const TYPE_RICH = 'rich'; + public const TYPE_PHOTO = 'photo'; + public const TYPE_VIDEO = 'video'; + public const TYPE_LINK = 'link'; + public const TYPE_FLAT = 'flat'; + public const TYPE_GOOGLE_DRIVE = 'googleDrive'; + public const TYPE_WORKSHEET = 'worksheet'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getTypeAllowableValues() + { + return [ + self::TYPE_RICH, + self::TYPE_PHOTO, + self::TYPE_VIDEO, + self::TYPE_LINK, + self::TYPE_FLAT, + self::TYPE_GOOGLE_DRIVE, + self::TYPE_WORKSHEET, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('score', $data ?? [], null); + $this->setIfExists('revision', $data ?? [], null); + $this->setIfExists('worksheet', $data ?? [], null); + $this->setIfExists('dedicated', $data ?? [], null); + $this->setIfExists('track', $data ?? [], null); + $this->setIfExists('part_uuid', $data ?? [], null); + $this->setIfExists('sharing_mode', $data ?? [], null); + $this->setIfExists('lock_score_template', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('html', $data ?? [], null); + $this->setIfExists('html_width', $data ?? [], null); + $this->setIfExists('html_height', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('thumbnail_url', $data ?? [], null); + $this->setIfExists('thumbnail_width', $data ?? [], null); + $this->setIfExists('thumbnail_height', $data ?? [], null); + $this->setIfExists('author_name', $data ?? [], null); + $this->setIfExists('author_url', $data ?? [], null); + $this->setIfExists('icon_url', $data ?? [], null); + $this->setIfExists('mime_type', $data ?? [], null); + $this->setIfExists('google_drive_file_id', $data ?? [], null); + $this->setIfExists('teacher_only', $data ?? [], false); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + $allowedValues = self::getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string + */ + public function getType(): string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type The type of the assignment resolved: * `rich`, `photo`, `video` are automatically resolved as `link` * A `flat` attachment is a score document where the unique identifier will be specified in the `score` property. Its sharing mode will be provided in the `sharingMode` property. + * + * @return $this + */ + public function setType(string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = self::getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets score + * + * @return string|null + */ + public function getScore(): ?string + { + return $this->container['score']; + } + + /** + * Sets score + * + * @param string|null $score An unique Flat score identifier + * + * @return $this + */ + public function setScore(?string $score): static + { + if (is_null($score)) { + throw new InvalidArgumentException('non-nullable score cannot be null'); + } + $this->container['score'] = $score; + + return $this; + } + + /** + * Gets revision + * + * @return string|null + */ + public function getRevision(): ?string + { + return $this->container['revision']; + } + + /** + * Sets revision + * + * @param string|null $revision An unique revision identifier of a score + * + * @return $this + */ + public function setRevision(?string $revision): static + { + if (is_null($revision)) { + throw new InvalidArgumentException('non-nullable revision cannot be null'); + } + $this->container['revision'] = $revision; + + return $this; + } + + /** + * Gets worksheet + * + * @return string|null + */ + public function getWorksheet(): ?string + { + return $this->container['worksheet']; + } + + /** + * Sets worksheet + * + * @param string|null $worksheet An unique worksheet identifier + * + * @return $this + */ + public function setWorksheet(?string $worksheet): static + { + if (is_null($worksheet)) { + throw new InvalidArgumentException('non-nullable worksheet cannot be null'); + } + $this->container['worksheet'] = $worksheet; + + return $this; + } + + /** + * Gets dedicated + * + * @return bool|null + */ + public function getDedicated(): ?bool + { + return $this->container['dedicated']; + } + + /** + * Sets dedicated + * + * @param bool|null $dedicated True if the resource is dedicated for the assignment (for scores and worksheets), meaning on the user-side this one is stored in the assignment + * + * @return $this + */ + public function setDedicated(?bool $dedicated): static + { + if (is_null($dedicated)) { + throw new InvalidArgumentException('non-nullable dedicated cannot be null'); + } + $this->container['dedicated'] = $dedicated; + + return $this; + } + + /** + * Gets track + * + * @return string|null + */ + public function getTrack(): ?string + { + return $this->container['track']; + } + + /** + * Sets track + * + * @param string|null $track A unique track identifier + * + * @return $this + */ + public function setTrack(?string $track): static + { + if (is_null($track)) { + throw new InvalidArgumentException('non-nullable track cannot be null'); + } + $this->container['track'] = $track; + + return $this; + } + + /** + * Gets part_uuid + * + * @return string|null + */ + public function getPartUuid(): ?string + { + return $this->container['part_uuid']; + } + + /** + * Sets part_uuid + * + * @param string|null $part_uuid The UUID of the instrument part selected for this attachment (for performance submissions) + * + * @return $this + */ + public function setPartUuid(?string $part_uuid): static + { + if (is_null($part_uuid)) { + throw new InvalidArgumentException('non-nullable part_uuid cannot be null'); + } + $this->container['part_uuid'] = $part_uuid; + + return $this; + } + + /** + * Gets sharing_mode + * + * @return \Flat\APIClient\Model\MediaScoreSharingMode|null + */ + public function getSharingMode(): ?\Flat\APIClient\Model\MediaScoreSharingMode + { + return $this->container['sharing_mode']; + } + + /** + * Sets sharing_mode + * + * @param \Flat\APIClient\Model\MediaScoreSharingMode|null $sharing_mode sharing_mode + * + * @return $this + */ + public function setSharingMode(?\Flat\APIClient\Model\MediaScoreSharingMode $sharing_mode): static + { + if (is_null($sharing_mode)) { + throw new InvalidArgumentException('non-nullable sharing_mode cannot be null'); + } + $this->container['sharing_mode'] = $sharing_mode; + + return $this; + } + + /** + * Gets lock_score_template + * + * @return bool|null + */ + public function getLockScoreTemplate(): ?bool + { + return $this->container['lock_score_template']; + } + + /** + * Sets lock_score_template + * + * @param bool|null $lock_score_template To be used with a score attached in `sharingMode` `copy` (score used as template). If true, students won't be able to change the original notes of the template. + * + * @return $this + */ + public function setLockScoreTemplate(?bool $lock_score_template): static + { + if (is_null($lock_score_template)) { + throw new InvalidArgumentException('non-nullable lock_score_template cannot be null'); + } + $this->container['lock_score_template'] = $lock_score_template; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle(): ?string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The resolved title of the attachment + * + * @return $this + */ + public function setTitle(?string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description The resolved description of the attachment + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets html + * + * @return string|null + */ + public function getHtml(): ?string + { + return $this->container['html']; + } + + /** + * Sets html + * + * @param string|null $html If the attachment type is `rich` or `video`, the HTML code of the media to display + * + * @return $this + */ + public function setHtml(?string $html): static + { + if (is_null($html)) { + throw new InvalidArgumentException('non-nullable html cannot be null'); + } + $this->container['html'] = $html; + + return $this; + } + + /** + * Gets html_width + * + * @return float|null + */ + public function getHtmlWidth(): ?float + { + return $this->container['html_width']; + } + + /** + * Sets html_width + * + * @param float|null $html_width If the `html` is available, the width of the widget + * + * @return $this + */ + public function setHtmlWidth(?float $html_width): static + { + if (is_null($html_width)) { + throw new InvalidArgumentException('non-nullable html_width cannot be null'); + } + $this->container['html_width'] = $html_width; + + return $this; + } + + /** + * Gets html_height + * + * @return float|null + */ + public function getHtmlHeight(): ?float + { + return $this->container['html_height']; + } + + /** + * Sets html_height + * + * @param float|null $html_height If the `html` is available, the height of the widget + * + * @return $this + */ + public function setHtmlHeight(?float $html_height): static + { + if (is_null($html_height)) { + throw new InvalidArgumentException('non-nullable html_height cannot be null'); + } + $this->container['html_height'] = $html_height; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl(): ?string + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The url of the attachment + * + * @return $this + */ + public function setUrl(?string $url): static + { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets thumbnail_url + * + * @return string|null + */ + public function getThumbnailUrl(): ?string + { + return $this->container['thumbnail_url']; + } + + /** + * Sets thumbnail_url + * + * @param string|null $thumbnail_url If the attachment type is `rich`, `video`, `photo` or `link`, a displayable thumbnail for this attachment + * + * @return $this + */ + public function setThumbnailUrl(?string $thumbnail_url): static + { + if (is_null($thumbnail_url)) { + throw new InvalidArgumentException('non-nullable thumbnail_url cannot be null'); + } + $this->container['thumbnail_url'] = $thumbnail_url; + + return $this; + } + + /** + * Gets thumbnail_width + * + * @return int|null + */ + public function getThumbnailWidth(): ?int + { + return $this->container['thumbnail_width']; + } + + /** + * Sets thumbnail_width + * + * @param int|null $thumbnail_width If the `thumbnailUrl` is available, the width of the thumbnail + * + * @return $this + */ + public function setThumbnailWidth(?int $thumbnail_width): static + { + if (is_null($thumbnail_width)) { + throw new InvalidArgumentException('non-nullable thumbnail_width cannot be null'); + } + $this->container['thumbnail_width'] = $thumbnail_width; + + return $this; + } + + /** + * Gets thumbnail_height + * + * @return int|null + */ + public function getThumbnailHeight(): ?int + { + return $this->container['thumbnail_height']; + } + + /** + * Sets thumbnail_height + * + * @param int|null $thumbnail_height If the `thumbnailUrl` is available, the width of the thumbnail + * + * @return $this + */ + public function setThumbnailHeight(?int $thumbnail_height): static + { + if (is_null($thumbnail_height)) { + throw new InvalidArgumentException('non-nullable thumbnail_height cannot be null'); + } + $this->container['thumbnail_height'] = $thumbnail_height; + + return $this; + } + + /** + * Gets author_name + * + * @return string|null + */ + public function getAuthorName(): ?string + { + return $this->container['author_name']; + } + + /** + * Sets author_name + * + * @param string|null $author_name The resolved author name of the attachment + * + * @return $this + */ + public function setAuthorName(?string $author_name): static + { + if (is_null($author_name)) { + throw new InvalidArgumentException('non-nullable author_name cannot be null'); + } + $this->container['author_name'] = $author_name; + + return $this; + } + + /** + * Gets author_url + * + * @return string|null + */ + public function getAuthorUrl(): ?string + { + return $this->container['author_url']; + } + + /** + * Sets author_url + * + * @param string|null $author_url The resolved author url of the attachment + * + * @return $this + */ + public function setAuthorUrl(?string $author_url): static + { + if (is_null($author_url)) { + throw new InvalidArgumentException('non-nullable author_url cannot be null'); + } + $this->container['author_url'] = $author_url; + + return $this; + } + + /** + * Gets icon_url + * + * @return string|null + */ + public function getIconUrl(): ?string + { + return $this->container['icon_url']; + } + + /** + * Sets icon_url + * + * @param string|null $icon_url The URL of the icon + * + * @return $this + */ + public function setIconUrl(?string $icon_url): static + { + if (is_null($icon_url)) { + throw new InvalidArgumentException('non-nullable icon_url cannot be null'); + } + $this->container['icon_url'] = $icon_url; + + return $this; + } + + /** + * Gets mime_type + * + * @return string|null + */ + public function getMimeType(): ?string + { + return $this->container['mime_type']; + } + + /** + * Sets mime_type + * + * @param string|null $mime_type The mine type of the file + * + * @return $this + */ + public function setMimeType(?string $mime_type): static + { + if (is_null($mime_type)) { + throw new InvalidArgumentException('non-nullable mime_type cannot be null'); + } + $this->container['mime_type'] = $mime_type; + + return $this; + } + + /** + * Gets google_drive_file_id + * + * @return string|null + */ + public function getGoogleDriveFileId(): ?string + { + return $this->container['google_drive_file_id']; + } + + /** + * Sets google_drive_file_id + * + * @param string|null $google_drive_file_id The ID of the Google Drive File + * + * @return $this + */ + public function setGoogleDriveFileId(?string $google_drive_file_id): static + { + if (is_null($google_drive_file_id)) { + throw new InvalidArgumentException('non-nullable google_drive_file_id cannot be null'); + } + $this->container['google_drive_file_id'] = $google_drive_file_id; + + return $this; + } + + /** + * Gets teacher_only + * + * @return bool|null + */ + public function getTeacherOnly(): ?bool + { + return $this->container['teacher_only']; + } + + /** + * Sets teacher_only + * + * @param bool|null $teacher_only If true, this attachment is only visible to teachers. When students view the assignment, attachments with this flag will be filtered out. + * + * @return $this + */ + public function setTeacherOnly(?bool $teacher_only): static + { + if (is_null($teacher_only)) { + throw new InvalidArgumentException('non-nullable teacher_only cannot be null'); + } + $this->container['teacher_only'] = $teacher_only; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MediaScoreSharingMode.php b/src/Model/MediaScoreSharingMode.php new file mode 100644 index 0000000..b61f6e7 --- /dev/null +++ b/src/Model/MediaScoreSharingMode.php @@ -0,0 +1,50 @@ + + */ +class MicrosoftGraphAssignment implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'MicrosoftGraphAssignment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'state' => 'string', + 'alternate_link' => 'string', + 'assign_date_time' => '\DateTime', + 'categories' => 'string[]', + 'assign_to_type' => 'string', + 'assigned_students_ms_ids' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'state' => null, + 'alternate_link' => null, + 'assign_date_time' => 'date-time', + 'categories' => null, + 'assign_to_type' => null, + 'assigned_students_ms_ids' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'state' => false, + 'alternate_link' => false, + 'assign_date_time' => false, + 'categories' => false, + 'assign_to_type' => false, + 'assigned_students_ms_ids' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'state' => 'state', + 'alternate_link' => 'alternateLink', + 'assign_date_time' => 'assignDateTime', + 'categories' => 'categories', + 'assign_to_type' => 'assignToType', + 'assigned_students_ms_ids' => 'assignedStudentsMsIds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'state' => 'setState', + 'alternate_link' => 'setAlternateLink', + 'assign_date_time' => 'setAssignDateTime', + 'categories' => 'setCategories', + 'assign_to_type' => 'setAssignToType', + 'assigned_students_ms_ids' => 'setAssignedStudentsMsIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'state' => 'getState', + 'alternate_link' => 'getAlternateLink', + 'assign_date_time' => 'getAssignDateTime', + 'categories' => 'getCategories', + 'assign_to_type' => 'getAssignToType', + 'assigned_students_ms_ids' => 'getAssignedStudentsMsIds' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const STATE_DRAFT = 'draft'; + public const STATE_SCHEDULED = 'scheduled'; + public const STATE_PUBLISHED = 'published'; + public const STATE_ASSIGNED = 'assigned'; + public const STATE_INACTIVE = 'inactive'; + public const ASSIGN_TO_TYPE__CLASS = 'class'; + public const ASSIGN_TO_TYPE_INDIVIDUAL = 'individual'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getStateAllowableValues() + { + return [ + self::STATE_DRAFT, + self::STATE_SCHEDULED, + self::STATE_PUBLISHED, + self::STATE_ASSIGNED, + self::STATE_INACTIVE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getAssignToTypeAllowableValues() + { + return [ + self::ASSIGN_TO_TYPE__CLASS, + self::ASSIGN_TO_TYPE_INDIVIDUAL, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('alternate_link', $data ?? [], null); + $this->setIfExists('assign_date_time', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('assign_to_type', $data ?? [], null); + $this->setIfExists('assigned_students_ms_ids', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = self::getStateAllowableValues(); + if (!is_null($this->container['state']) && !in_array($this->container['state'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'state', must be one of '%s'", + $this->container['state'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = self::getAssignToTypeAllowableValues(); + if (!is_null($this->container['assign_to_type']) && !in_array($this->container['assign_to_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'assign_to_type', must be one of '%s'", + $this->container['assign_to_type'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Identifier of the assignment assigned by Microsoft Teams + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState(): ?string + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state State of the assignment on Microsoft Teams. * `draft`: Assignment is in draft mode * `scheduled`: Assignment is scheduled to be published at a future date * `published`: Assignment has been published to students * `assigned`: Assignment has been assigned (legacy status) * `inactive`: Assignment is inactive + * + * @return $this + */ + public function setState(?string $state): static + { + if (is_null($state)) { + throw new InvalidArgumentException('non-nullable state cannot be null'); + } + $allowedValues = self::getStateAllowableValues(); + if (!in_array($state, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'state', must be one of '%s'", + $state, + implode("', '", $allowedValues) + ) + ); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets alternate_link + * + * @return string|null + */ + public function getAlternateLink(): ?string + { + return $this->container['alternate_link']; + } + + /** + * Sets alternate_link + * + * @param string|null $alternate_link Absolute link to this assignment in the Microsoft Teams web UI + * + * @return $this + */ + public function setAlternateLink(?string $alternate_link): static + { + if (is_null($alternate_link)) { + throw new InvalidArgumentException('non-nullable alternate_link cannot be null'); + } + $this->container['alternate_link'] = $alternate_link; + + return $this; + } + + /** + * Gets assign_date_time + * + * @return \DateTime|null + */ + public function getAssignDateTime(): ?\DateTime + { + return $this->container['assign_date_time']; + } + + /** + * Sets assign_date_time + * + * @param \DateTime|null $assign_date_time The date when the assignment will become active on Microsoft Teams. If set to a future date, the assignment will have status `scheduled` and won't be visible to students until this date. + * + * @return $this + */ + public function setAssignDateTime(?\DateTime $assign_date_time): static + { + if (is_null($assign_date_time)) { + throw new InvalidArgumentException('non-nullable assign_date_time cannot be null'); + } + $this->container['assign_date_time'] = $assign_date_time; + + return $this; + } + + /** + * Gets categories + * + * @return string[]|null + */ + public function getCategories(): ?array + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param string[]|null $categories List of categories where this assignment is published under + * + * @return $this + */ + public function setCategories(?array $categories): static + { + if (is_null($categories)) { + throw new InvalidArgumentException('non-nullable categories cannot be null'); + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets assign_to_type + * + * @return string|null + */ + public function getAssignToType(): ?string + { + return $this->container['assign_to_type']; + } + + /** + * Sets assign_to_type + * + * @param string|null $assign_to_type Recipient configuration for this assignment on Microsoft Teams. * `class`: Assignment is visible to all students in the class * `individual`: Assignment is visible only to specific assigned students + * + * @return $this + */ + public function setAssignToType(?string $assign_to_type): static + { + if (is_null($assign_to_type)) { + throw new InvalidArgumentException('non-nullable assign_to_type cannot be null'); + } + $allowedValues = self::getAssignToTypeAllowableValues(); + if (!in_array($assign_to_type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'assign_to_type', must be one of '%s'", + $assign_to_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['assign_to_type'] = $assign_to_type; + + return $this; + } + + /** + * Gets assigned_students_ms_ids + * + * @return string[]|null + */ + public function getAssignedStudentsMsIds(): ?array + { + return $this->container['assigned_students_ms_ids']; + } + + /** + * Sets assigned_students_ms_ids + * + * @param string[]|null $assigned_students_ms_ids When assignToType is 'individual', array of Microsoft Azure user IDs of students assigned to this assignment. These are the students who can see and submit to this assignment on Teams. + * + * @return $this + */ + public function setAssignedStudentsMsIds(?array $assigned_students_ms_ids): static + { + if (is_null($assigned_students_ms_ids)) { + throw new InvalidArgumentException('non-nullable assigned_students_ms_ids cannot be null'); + } + $this->container['assigned_students_ms_ids'] = $assigned_students_ms_ids; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MicrosoftGraphSubmission.php b/src/Model/MicrosoftGraphSubmission.php new file mode 100644 index 0000000..b01df4c --- /dev/null +++ b/src/Model/MicrosoftGraphSubmission.php @@ -0,0 +1,425 @@ + + */ +class MicrosoftGraphSubmission implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'MicrosoftGraphSubmission'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'state' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'state' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'state' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'state' => 'state' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'state' => 'setState' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'state' => 'getState' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['state'] === null) { + $invalidProperties[] = "'state' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Identifier of the submission assigned by Microsoft Teams + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets state + * + * @return string + */ + public function getState(): string + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string $state State of the submission + * + * @return $this + */ + public function setState(string $state): static + { + if (is_null($state)) { + throw new InvalidArgumentException('non-nullable state cannot be null'); + } + $this->container['state'] = $state; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ModelInterface.php b/src/Model/ModelInterface.php new file mode 100644 index 0000000..3ce521e --- /dev/null +++ b/src/Model/ModelInterface.php @@ -0,0 +1,112 @@ + + */ + public static function openAPITypes(): array; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array; + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array; + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid(): bool; + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool; + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool; +} diff --git a/src/Model/OmrCapabilities.php b/src/Model/OmrCapabilities.php new file mode 100644 index 0000000..a228a14 --- /dev/null +++ b/src/Model/OmrCapabilities.php @@ -0,0 +1,860 @@ + + */ +class OmrCapabilities implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OmrCapabilities'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'steps' => '\Flat\APIClient\Model\OmrStepName[]', + 'formats' => 'string[]', + 'outputs' => '\Flat\APIClient\Model\OmrJobOutput[]', + 'max_files' => 'int', + 'max_pages' => 'int', + 'max_parallel_jobs' => 'int', + 'max_file_size' => 'int', + 'accepted_mime_types' => 'string[]', + 'accepted_extensions' => 'string[]', + 'cost_per_page' => 'int', + 'remaining_credits' => 'int', + 'retention_days' => 'int', + 'locales' => 'string[]', + 'locales_details' => '\Flat\APIClient\Model\OmrLocaleDetails[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'steps' => null, + 'formats' => null, + 'outputs' => null, + 'max_files' => null, + 'max_pages' => null, + 'max_parallel_jobs' => null, + 'max_file_size' => null, + 'accepted_mime_types' => null, + 'accepted_extensions' => null, + 'cost_per_page' => null, + 'remaining_credits' => null, + 'retention_days' => null, + 'locales' => null, + 'locales_details' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'steps' => false, + 'formats' => false, + 'outputs' => false, + 'max_files' => false, + 'max_pages' => false, + 'max_parallel_jobs' => false, + 'max_file_size' => false, + 'accepted_mime_types' => false, + 'accepted_extensions' => false, + 'cost_per_page' => false, + 'remaining_credits' => false, + 'retention_days' => false, + 'locales' => false, + 'locales_details' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'steps' => 'steps', + 'formats' => 'formats', + 'outputs' => 'outputs', + 'max_files' => 'maxFiles', + 'max_pages' => 'maxPages', + 'max_parallel_jobs' => 'maxParallelJobs', + 'max_file_size' => 'maxFileSize', + 'accepted_mime_types' => 'acceptedMimeTypes', + 'accepted_extensions' => 'acceptedExtensions', + 'cost_per_page' => 'costPerPage', + 'remaining_credits' => 'remainingCredits', + 'retention_days' => 'retentionDays', + 'locales' => 'locales', + 'locales_details' => 'localesDetails' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'steps' => 'setSteps', + 'formats' => 'setFormats', + 'outputs' => 'setOutputs', + 'max_files' => 'setMaxFiles', + 'max_pages' => 'setMaxPages', + 'max_parallel_jobs' => 'setMaxParallelJobs', + 'max_file_size' => 'setMaxFileSize', + 'accepted_mime_types' => 'setAcceptedMimeTypes', + 'accepted_extensions' => 'setAcceptedExtensions', + 'cost_per_page' => 'setCostPerPage', + 'remaining_credits' => 'setRemainingCredits', + 'retention_days' => 'setRetentionDays', + 'locales' => 'setLocales', + 'locales_details' => 'setLocalesDetails' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'steps' => 'getSteps', + 'formats' => 'getFormats', + 'outputs' => 'getOutputs', + 'max_files' => 'getMaxFiles', + 'max_pages' => 'getMaxPages', + 'max_parallel_jobs' => 'getMaxParallelJobs', + 'max_file_size' => 'getMaxFileSize', + 'accepted_mime_types' => 'getAcceptedMimeTypes', + 'accepted_extensions' => 'getAcceptedExtensions', + 'cost_per_page' => 'getCostPerPage', + 'remaining_credits' => 'getRemainingCredits', + 'retention_days' => 'getRetentionDays', + 'locales' => 'getLocales', + 'locales_details' => 'getLocalesDetails' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('steps', $data ?? [], null); + $this->setIfExists('formats', $data ?? [], null); + $this->setIfExists('outputs', $data ?? [], null); + $this->setIfExists('max_files', $data ?? [], null); + $this->setIfExists('max_pages', $data ?? [], null); + $this->setIfExists('max_parallel_jobs', $data ?? [], null); + $this->setIfExists('max_file_size', $data ?? [], null); + $this->setIfExists('accepted_mime_types', $data ?? [], null); + $this->setIfExists('accepted_extensions', $data ?? [], null); + $this->setIfExists('cost_per_page', $data ?? [], null); + $this->setIfExists('remaining_credits', $data ?? [], null); + $this->setIfExists('retention_days', $data ?? [], null); + $this->setIfExists('locales', $data ?? [], null); + $this->setIfExists('locales_details', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['steps'] === null) { + $invalidProperties[] = "'steps' can't be null"; + } + if ($this->container['formats'] === null) { + $invalidProperties[] = "'formats' can't be null"; + } + if ($this->container['outputs'] === null) { + $invalidProperties[] = "'outputs' can't be null"; + } + if ($this->container['max_files'] === null) { + $invalidProperties[] = "'max_files' can't be null"; + } + if ($this->container['max_pages'] === null) { + $invalidProperties[] = "'max_pages' can't be null"; + } + if ($this->container['max_parallel_jobs'] === null) { + $invalidProperties[] = "'max_parallel_jobs' can't be null"; + } + if ($this->container['max_file_size'] === null) { + $invalidProperties[] = "'max_file_size' can't be null"; + } + if ($this->container['accepted_mime_types'] === null) { + $invalidProperties[] = "'accepted_mime_types' can't be null"; + } + if ($this->container['accepted_extensions'] === null) { + $invalidProperties[] = "'accepted_extensions' can't be null"; + } + if ($this->container['locales'] === null) { + $invalidProperties[] = "'locales' can't be null"; + } + if ($this->container['locales_details'] === null) { + $invalidProperties[] = "'locales_details' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets steps + * + * @return \Flat\APIClient\Model\OmrStepName[] + */ + public function getSteps(): array + { + return $this->container['steps']; + } + + /** + * Sets steps + * + * @param \Flat\APIClient\Model\OmrStepName[] $steps Interactive steps this server supports. + * + * @return $this + */ + public function setSteps(array $steps): static + { + if (is_null($steps)) { + throw new InvalidArgumentException('non-nullable steps cannot be null'); + } + $this->container['steps'] = $steps; + + return $this; + } + + /** + * Gets formats + * + * @return string[] + */ + public function getFormats(): array + { + return $this->container['formats']; + } + + /** + * Sets formats + * + * @param string[] $formats Export formats available via `getOmrJobExport`. + * + * @return $this + */ + public function setFormats(array $formats): static + { + if (is_null($formats)) { + throw new InvalidArgumentException('non-nullable formats cannot be null'); + } + $this->container['formats'] = $formats; + + return $this; + } + + /** + * Gets outputs + * + * @return \Flat\APIClient\Model\OmrJobOutput[] + */ + public function getOutputs(): array + { + return $this->container['outputs']; + } + + /** + * Sets outputs + * + * @param \Flat\APIClient\Model\OmrJobOutput[] $outputs Output destinations the account can use when creating a job. + * + * @return $this + */ + public function setOutputs(array $outputs): static + { + if (is_null($outputs)) { + throw new InvalidArgumentException('non-nullable outputs cannot be null'); + } + $this->container['outputs'] = $outputs; + + return $this; + } + + /** + * Gets max_files + * + * @return int + */ + public function getMaxFiles(): int + { + return $this->container['max_files']; + } + + /** + * Sets max_files + * + * @param int $max_files Maximum number of input files that can be added to a single job. + * + * @return $this + */ + public function setMaxFiles(int $max_files): static + { + if (is_null($max_files)) { + throw new InvalidArgumentException('non-nullable max_files cannot be null'); + } + $this->container['max_files'] = $max_files; + + return $this; + } + + /** + * Gets max_pages + * + * @return int + */ + public function getMaxPages(): int + { + return $this->container['max_pages']; + } + + /** + * Sets max_pages + * + * @param int $max_pages Maximum number of pages allowed across all input files of a single job. + * + * @return $this + */ + public function setMaxPages(int $max_pages): static + { + if (is_null($max_pages)) { + throw new InvalidArgumentException('non-nullable max_pages cannot be null'); + } + $this->container['max_pages'] = $max_pages; + + return $this; + } + + /** + * Gets max_parallel_jobs + * + * @return int + */ + public function getMaxParallelJobs(): int + { + return $this->container['max_parallel_jobs']; + } + + /** + * Sets max_parallel_jobs + * + * @param int $max_parallel_jobs Maximum number of OMR jobs that can run in parallel for this account. + * + * @return $this + */ + public function setMaxParallelJobs(int $max_parallel_jobs): static + { + if (is_null($max_parallel_jobs)) { + throw new InvalidArgumentException('non-nullable max_parallel_jobs cannot be null'); + } + $this->container['max_parallel_jobs'] = $max_parallel_jobs; + + return $this; + } + + /** + * Gets max_file_size + * + * @return int + */ + public function getMaxFileSize(): int + { + return $this->container['max_file_size']; + } + + /** + * Sets max_file_size + * + * @param int $max_file_size Maximum size of a single file, in bytes. + * + * @return $this + */ + public function setMaxFileSize(int $max_file_size): static + { + if (is_null($max_file_size)) { + throw new InvalidArgumentException('non-nullable max_file_size cannot be null'); + } + $this->container['max_file_size'] = $max_file_size; + + return $this; + } + + /** + * Gets accepted_mime_types + * + * @return string[] + */ + public function getAcceptedMimeTypes(): array + { + return $this->container['accepted_mime_types']; + } + + /** + * Sets accepted_mime_types + * + * @param string[] $accepted_mime_types MIME types accepted for input files: PDF, plus the raster image formats. Drive the file picker from this list rather than hardcoding it, so newly supported formats need no client release. A file is identified by its content, so its declared type and its extension do not have to match. A multi-page input counts as several pages against `maxPages` and is charged accordingly. That covers PDFs and, among the image formats, multi-page TIFF and animated GIF/WebP. + * + * @return $this + */ + public function setAcceptedMimeTypes(array $accepted_mime_types): static + { + if (is_null($accepted_mime_types)) { + throw new InvalidArgumentException('non-nullable accepted_mime_types cannot be null'); + } + $this->container['accepted_mime_types'] = $accepted_mime_types; + + return $this; + } + + /** + * Gets accepted_extensions + * + * @return string[] + */ + public function getAcceptedExtensions(): array + { + return $this->container['accepted_extensions']; + } + + /** + * Sets accepted_extensions + * + * @param string[] $accepted_extensions Filename extensions the accepted types appear under, for building a file picker. Use these alongside `acceptedMimeTypes` in an `accept` attribute: browsers and native file dialogs filter unreliably on some of the image types, so a valid file can be greyed out when only its MIME type is offered. Longer than `acceptedMimeTypes`, because one type arrives under several extensions (`.jpg` and `.jpeg`, `.tif` and `.tiff`, `.heic` and `.heif`). Picker metadata only. A file is identified by its content, so its extension never decides whether an upload is accepted. + * + * @return $this + */ + public function setAcceptedExtensions(array $accepted_extensions): static + { + if (is_null($accepted_extensions)) { + throw new InvalidArgumentException('non-nullable accepted_extensions cannot be null'); + } + $this->container['accepted_extensions'] = $accepted_extensions; + + return $this; + } + + /** + * Gets cost_per_page + * + * @return int|null + */ + public function getCostPerPage(): ?int + { + return $this->container['cost_per_page']; + } + + /** + * Sets cost_per_page + * + * @param int|null $cost_per_page Credits charged per page. + * + * @return $this + */ + public function setCostPerPage(?int $cost_per_page): static + { + if (is_null($cost_per_page)) { + throw new InvalidArgumentException('non-nullable cost_per_page cannot be null'); + } + $this->container['cost_per_page'] = $cost_per_page; + + return $this; + } + + /** + * Gets remaining_credits + * + * @return int|null + */ + public function getRemainingCredits(): ?int + { + return $this->container['remaining_credits']; + } + + /** + * Sets remaining_credits + * + * @param int|null $remaining_credits OMR credits remaining for the account. + * + * @return $this + */ + public function setRemainingCredits(?int $remaining_credits): static + { + if (is_null($remaining_credits)) { + throw new InvalidArgumentException('non-nullable remaining_credits cannot be null'); + } + $this->container['remaining_credits'] = $remaining_credits; + + return $this; + } + + /** + * Gets retention_days + * + * @return int|null + */ + public function getRetentionDays(): ?int + { + return $this->container['retention_days']; + } + + /** + * Sets retention_days + * + * @param int|null $retention_days How many days a `musicxml` job's uploaded files and results are kept before erasure. Reflects the account's own period when one has been set, otherwise the platform default. Read-only: contact support to change it. Jobs with `output: library` are not covered by the retention policy and are unaffected by this value. + * + * @return $this + */ + public function setRetentionDays(?int $retention_days): static + { + if (is_null($retention_days)) { + throw new InvalidArgumentException('non-nullable retention_days cannot be null'); + } + $this->container['retention_days'] = $retention_days; + + return $this; + } + + /** + * Gets locales + * + * @return string[] + */ + public function getLocales(): array + { + return $this->container['locales']; + } + + /** + * Sets locales + * + * @param string[] $locales Locales selectable for OCR, as BCP 47 codes sorted alphabetically. These are the locales the recognition pipeline can actually read, which is neither the list of Flat interface locales nor a fixed set: new languages are added over time. Clients should default to the user's own locale when it appears here. + * + * @return $this + */ + public function setLocales(array $locales): static + { + if (is_null($locales)) { + throw new InvalidArgumentException('non-nullable locales cannot be null'); + } + $this->container['locales'] = $locales; + + return $this; + } + + /** + * Gets locales_details + * + * @return \Flat\APIClient\Model\OmrLocaleDetails[] + */ + public function getLocalesDetails(): array + { + return $this->container['locales_details']; + } + + /** + * Sets locales_details + * + * @param \Flat\APIClient\Model\OmrLocaleDetails[] $locales_details The same locales as `locales`, each with its English display name, sorted alphabetically by `name` and ready to bind to a language picker. Prefer this over `locales` when rendering a selector: it saves clients from shipping their own code-to-label table. + * + * @return $this + */ + public function setLocalesDetails(array $locales_details): static + { + if (is_null($locales_details)) { + throw new InvalidArgumentException('non-nullable locales_details cannot be null'); + } + $this->container['locales_details'] = $locales_details; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OmrDetailsStepData.php b/src/Model/OmrDetailsStepData.php new file mode 100644 index 0000000..633983d --- /dev/null +++ b/src/Model/OmrDetailsStepData.php @@ -0,0 +1,491 @@ + + */ +class OmrDetailsStepData implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OmrDetailsStepData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'step' => 'string', + 'title' => 'string', + 'instruments' => '\Flat\APIClient\Model\OmrDetectedInstrument[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'step' => null, + 'title' => null, + 'instruments' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'step' => false, + 'title' => false, + 'instruments' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'step' => 'step', + 'title' => 'title', + 'instruments' => 'instruments' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'step' => 'setStep', + 'title' => 'setTitle', + 'instruments' => 'setInstruments' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'step' => 'getStep', + 'title' => 'getTitle', + 'instruments' => 'getInstruments' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const STEP_DETAILS = 'details'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getStepAllowableValues() + { + return [ + self::STEP_DETAILS, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('step', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('instruments', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['step'] === null) { + $invalidProperties[] = "'step' can't be null"; + } + $allowedValues = self::getStepAllowableValues(); + if (!is_null($this->container['step']) && !in_array($this->container['step'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'step', must be one of '%s'", + $this->container['step'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['instruments'] === null) { + $invalidProperties[] = "'instruments' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets step + * + * @return string + */ + public function getStep(): string + { + return $this->container['step']; + } + + /** + * Sets step + * + * @param string $step Discriminator for `OmrPendingStep.data`; always `details` for this payload. + * + * @return $this + */ + public function setStep(string $step): static + { + if (is_null($step)) { + throw new InvalidArgumentException('non-nullable step cannot be null'); + } + $allowedValues = self::getStepAllowableValues(); + if (!in_array($step, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'step', must be one of '%s'", + $step, + implode("', '", $allowedValues) + ) + ); + } + $this->container['step'] = $step; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle(): ?string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title OCR-detected work title. + * + * @return $this + */ + public function setTitle(?string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets instruments + * + * @return \Flat\APIClient\Model\OmrDetectedInstrument[] + */ + public function getInstruments(): array + { + return $this->container['instruments']; + } + + /** + * Sets instruments + * + * @param \Flat\APIClient\Model\OmrDetectedInstrument[] $instruments instruments + * + * @return $this + */ + public function setInstruments(array $instruments): static + { + if (is_null($instruments)) { + throw new InvalidArgumentException('non-nullable instruments cannot be null'); + } + $this->container['instruments'] = $instruments; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OmrDetailsSubmission.php b/src/Model/OmrDetailsSubmission.php new file mode 100644 index 0000000..e3b483b --- /dev/null +++ b/src/Model/OmrDetailsSubmission.php @@ -0,0 +1,552 @@ + + */ +class OmrDetailsSubmission implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OmrDetailsSubmission'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'step' => 'string', + 'title' => 'string', + 'main_language' => 'string', + 'instruments' => '\Flat\APIClient\Model\OmrInstrumentOverride[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'step' => null, + 'title' => null, + 'main_language' => null, + 'instruments' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'step' => false, + 'title' => false, + 'main_language' => false, + 'instruments' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'step' => 'step', + 'title' => 'title', + 'main_language' => 'mainLanguage', + 'instruments' => 'instruments' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'step' => 'setStep', + 'title' => 'setTitle', + 'main_language' => 'setMainLanguage', + 'instruments' => 'setInstruments' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'step' => 'getStep', + 'title' => 'getTitle', + 'main_language' => 'getMainLanguage', + 'instruments' => 'getInstruments' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const STEP_DETAILS = 'details'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getStepAllowableValues() + { + return [ + self::STEP_DETAILS, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('step', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('main_language', $data ?? [], null); + $this->setIfExists('instruments', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['step'] === null) { + $invalidProperties[] = "'step' can't be null"; + } + $allowedValues = self::getStepAllowableValues(); + if (!is_null($this->container['step']) && !in_array($this->container['step'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'step', must be one of '%s'", + $this->container['step'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['title']) && (mb_strlen($this->container['title']) > 500)) { + $invalidProperties[] = "invalid value for 'title', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['main_language']) && (mb_strlen($this->container['main_language']) > 35)) { + $invalidProperties[] = "invalid value for 'main_language', the character length must be smaller than or equal to 35."; + } + + if (!is_null($this->container['main_language']) && (mb_strlen($this->container['main_language']) < 1)) { + $invalidProperties[] = "invalid value for 'main_language', the character length must be bigger than or equal to 1."; + } + + if (!is_null($this->container['instruments']) && (count($this->container['instruments']) > 200)) { + $invalidProperties[] = "invalid value for 'instruments', number of items must be less than or equal to 200."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets step + * + * @return string + */ + public function getStep(): string + { + return $this->container['step']; + } + + /** + * Sets step + * + * @param string $step Discriminator for `OmrStepSubmission`; always `details` for this submission. + * + * @return $this + */ + public function setStep(string $step): static + { + if (is_null($step)) { + throw new InvalidArgumentException('non-nullable step cannot be null'); + } + $allowedValues = self::getStepAllowableValues(); + if (!in_array($step, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'step', must be one of '%s'", + $step, + implode("', '", $allowedValues) + ) + ); + } + $this->container['step'] = $step; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle(): ?string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title Override the detected work title. + * + * @return $this + */ + public function setTitle(?string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + if ((mb_strlen($title) > 500)) { + throw new InvalidArgumentException('invalid length for $title when calling OmrDetailsSubmission., must be smaller than or equal to 500.'); + } + + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets main_language + * + * @return string|null + */ + public function getMainLanguage(): ?string + { + return $this->container['main_language']; + } + + /** + * Sets main_language + * + * @param string|null $main_language Override the main language (BCP 47) used for lyric and text reading on resume. Defaults to the job locale (`locales`); set this to correct it on the review screen. + * + * @return $this + */ + public function setMainLanguage(?string $main_language): static + { + if (is_null($main_language)) { + throw new InvalidArgumentException('non-nullable main_language cannot be null'); + } + if ((mb_strlen($main_language) > 35)) { + throw new InvalidArgumentException('invalid length for $main_language when calling OmrDetailsSubmission., must be smaller than or equal to 35.'); + } + if ((mb_strlen($main_language) < 1)) { + throw new InvalidArgumentException('invalid length for $main_language when calling OmrDetailsSubmission., must be bigger than or equal to 1.'); + } + + $this->container['main_language'] = $main_language; + + return $this; + } + + /** + * Gets instruments + * + * @return \Flat\APIClient\Model\OmrInstrumentOverride[]|null + */ + public function getInstruments(): ?array + { + return $this->container['instruments']; + } + + /** + * Sets instruments + * + * @param \Flat\APIClient\Model\OmrInstrumentOverride[]|null $instruments Per-part overrides, each matched to a detected part by `index`. + * + * @return $this + */ + public function setInstruments(?array $instruments): static + { + if (is_null($instruments)) { + throw new InvalidArgumentException('non-nullable instruments cannot be null'); + } + if ((count($instruments) > 200)) { + throw new InvalidArgumentException('invalid value for $instruments when calling OmrDetailsSubmission., number of items must be less than or equal to 200.'); + } + $this->container['instruments'] = $instruments; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OmrDetectedInstrument.php b/src/Model/OmrDetectedInstrument.php new file mode 100644 index 0000000..62b963b --- /dev/null +++ b/src/Model/OmrDetectedInstrument.php @@ -0,0 +1,628 @@ + + */ +class OmrDetectedInstrument implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OmrDetectedInstrument'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'index' => 'int', + 'part_name' => 'string', + 'instrument_id' => 'string', + 'instrument_name' => 'string', + 'midi_program' => 'int', + 'transpose_key' => 'string', + 'resolved_confidence' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'index' => null, + 'part_name' => null, + 'instrument_id' => null, + 'instrument_name' => null, + 'midi_program' => null, + 'transpose_key' => null, + 'resolved_confidence' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'index' => false, + 'part_name' => false, + 'instrument_id' => false, + 'instrument_name' => false, + 'midi_program' => false, + 'transpose_key' => false, + 'resolved_confidence' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'index' => 'index', + 'part_name' => 'partName', + 'instrument_id' => 'instrumentId', + 'instrument_name' => 'instrumentName', + 'midi_program' => 'midiProgram', + 'transpose_key' => 'transposeKey', + 'resolved_confidence' => 'resolvedConfidence' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'index' => 'setIndex', + 'part_name' => 'setPartName', + 'instrument_id' => 'setInstrumentId', + 'instrument_name' => 'setInstrumentName', + 'midi_program' => 'setMidiProgram', + 'transpose_key' => 'setTransposeKey', + 'resolved_confidence' => 'setResolvedConfidence' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'index' => 'getIndex', + 'part_name' => 'getPartName', + 'instrument_id' => 'getInstrumentId', + 'instrument_name' => 'getInstrumentName', + 'midi_program' => 'getMidiProgram', + 'transpose_key' => 'getTransposeKey', + 'resolved_confidence' => 'getResolvedConfidence' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const RESOLVED_CONFIDENCE_HIGH = 'high'; + public const RESOLVED_CONFIDENCE_MEDIUM = 'medium'; + public const RESOLVED_CONFIDENCE_LOW = 'low'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getResolvedConfidenceAllowableValues() + { + return [ + self::RESOLVED_CONFIDENCE_HIGH, + self::RESOLVED_CONFIDENCE_MEDIUM, + self::RESOLVED_CONFIDENCE_LOW, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('index', $data ?? [], null); + $this->setIfExists('part_name', $data ?? [], null); + $this->setIfExists('instrument_id', $data ?? [], null); + $this->setIfExists('instrument_name', $data ?? [], null); + $this->setIfExists('midi_program', $data ?? [], null); + $this->setIfExists('transpose_key', $data ?? [], null); + $this->setIfExists('resolved_confidence', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['index'] === null) { + $invalidProperties[] = "'index' can't be null"; + } + $allowedValues = self::getResolvedConfidenceAllowableValues(); + if (!is_null($this->container['resolved_confidence']) && !in_array($this->container['resolved_confidence'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'resolved_confidence', must be one of '%s'", + $this->container['resolved_confidence'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets index + * + * @return int + */ + public function getIndex(): int + { + return $this->container['index']; + } + + /** + * Sets index + * + * @param int $index 0-based position of the part in the score. + * + * @return $this + */ + public function setIndex(int $index): static + { + if (is_null($index)) { + throw new InvalidArgumentException('non-nullable index cannot be null'); + } + $this->container['index'] = $index; + + return $this; + } + + /** + * Gets part_name + * + * @return string|null + */ + public function getPartName(): ?string + { + return $this->container['part_name']; + } + + /** + * Sets part_name + * + * @param string|null $part_name Verbatim part name read from the score. + * + * @return $this + */ + public function setPartName(?string $part_name): static + { + if (is_null($part_name)) { + throw new InvalidArgumentException('non-nullable part_name cannot be null'); + } + $this->container['part_name'] = $part_name; + + return $this; + } + + /** + * Gets instrument_id + * + * @return string|null + */ + public function getInstrumentId(): ?string + { + return $this->container['instrument_id']; + } + + /** + * Sets instrument_id + * + * @param string|null $instrument_id Flat instrument ID in dotted `.` form, for example `brass.horn` or `vocals.voice-oohs`. See the [Instrument IDs reference](https://flat.io/developers/docs/api/instruments). Always the canonical (non-premium) ID. + * + * @return $this + */ + public function setInstrumentId(?string $instrument_id): static + { + if (is_null($instrument_id)) { + throw new InvalidArgumentException('non-nullable instrument_id cannot be null'); + } + $this->container['instrument_id'] = $instrument_id; + + return $this; + } + + /** + * Gets instrument_name + * + * @return string|null + */ + public function getInstrumentName(): ?string + { + return $this->container['instrument_name']; + } + + /** + * Sets instrument_name + * + * @param string|null $instrument_name Localized display name, resolved server-side so the client needs no instruments dictionary. + * + * @return $this + */ + public function setInstrumentName(?string $instrument_name): static + { + if (is_null($instrument_name)) { + throw new InvalidArgumentException('non-nullable instrument_name cannot be null'); + } + $this->container['instrument_name'] = $instrument_name; + + return $this; + } + + /** + * Gets midi_program + * + * @return int|null + */ + public function getMidiProgram(): ?int + { + return $this->container['midi_program']; + } + + /** + * Sets midi_program + * + * @param int|null $midi_program General MIDI program number. + * + * @return $this + */ + public function setMidiProgram(?int $midi_program): static + { + if (is_null($midi_program)) { + throw new InvalidArgumentException('non-nullable midi_program cannot be null'); + } + $this->container['midi_program'] = $midi_program; + + return $this; + } + + /** + * Gets transpose_key + * + * @return string|null + */ + public function getTransposeKey(): ?string + { + return $this->container['transpose_key']; + } + + /** + * Sets transpose_key + * + * @param string|null $transpose_key Transposition or written key shown in the UI, for example `F` for Horn in F. + * + * @return $this + */ + public function setTransposeKey(?string $transpose_key): static + { + if (is_null($transpose_key)) { + throw new InvalidArgumentException('non-nullable transpose_key cannot be null'); + } + $this->container['transpose_key'] = $transpose_key; + + return $this; + } + + /** + * Gets resolved_confidence + * + * @return string|null + */ + public function getResolvedConfidence(): ?string + { + return $this->container['resolved_confidence']; + } + + /** + * Sets resolved_confidence + * + * @param string|null $resolved_confidence Server confidence in the resolved instrument match. + * + * @return $this + */ + public function setResolvedConfidence(?string $resolved_confidence): static + { + if (is_null($resolved_confidence)) { + throw new InvalidArgumentException('non-nullable resolved_confidence cannot be null'); + } + $allowedValues = self::getResolvedConfidenceAllowableValues(); + if (!in_array($resolved_confidence, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'resolved_confidence', must be one of '%s'", + $resolved_confidence, + implode("', '", $allowedValues) + ) + ); + } + $this->container['resolved_confidence'] = $resolved_confidence; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OmrImportedMetadata.php b/src/Model/OmrImportedMetadata.php new file mode 100644 index 0000000..da44a1f --- /dev/null +++ b/src/Model/OmrImportedMetadata.php @@ -0,0 +1,487 @@ + + */ +class OmrImportedMetadata implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OmrImportedMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'instruments' => 'string[]', + 'number_measures' => 'int', + 'main_tempo_qpm' => 'float', + 'main_key_signature' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'instruments' => null, + 'number_measures' => null, + 'main_tempo_qpm' => null, + 'main_key_signature' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'instruments' => false, + 'number_measures' => false, + 'main_tempo_qpm' => false, + 'main_key_signature' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'instruments' => 'instruments', + 'number_measures' => 'numberMeasures', + 'main_tempo_qpm' => 'mainTempoQpm', + 'main_key_signature' => 'mainKeySignature' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'instruments' => 'setInstruments', + 'number_measures' => 'setNumberMeasures', + 'main_tempo_qpm' => 'setMainTempoQpm', + 'main_key_signature' => 'setMainKeySignature' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'instruments' => 'getInstruments', + 'number_measures' => 'getNumberMeasures', + 'main_tempo_qpm' => 'getMainTempoQpm', + 'main_key_signature' => 'getMainKeySignature' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('instruments', $data ?? [], null); + $this->setIfExists('number_measures', $data ?? [], null); + $this->setIfExists('main_tempo_qpm', $data ?? [], null); + $this->setIfExists('main_key_signature', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets instruments + * + * @return string[]|null + */ + public function getInstruments(): ?array + { + return $this->container['instruments']; + } + + /** + * Sets instruments + * + * @param string[]|null $instruments Instrument IDs of the assembled parts. + * + * @return $this + */ + public function setInstruments(?array $instruments): static + { + if (is_null($instruments)) { + throw new InvalidArgumentException('non-nullable instruments cannot be null'); + } + $this->container['instruments'] = $instruments; + + return $this; + } + + /** + * Gets number_measures + * + * @return int|null + */ + public function getNumberMeasures(): ?int + { + return $this->container['number_measures']; + } + + /** + * Sets number_measures + * + * @param int|null $number_measures Number of measures in the recognized score. + * + * @return $this + */ + public function setNumberMeasures(?int $number_measures): static + { + if (is_null($number_measures)) { + throw new InvalidArgumentException('non-nullable number_measures cannot be null'); + } + $this->container['number_measures'] = $number_measures; + + return $this; + } + + /** + * Gets main_tempo_qpm + * + * @return float|null + */ + public function getMainTempoQpm(): ?float + { + return $this->container['main_tempo_qpm']; + } + + /** + * Sets main_tempo_qpm + * + * @param float|null $main_tempo_qpm Main tempo, in quarter notes per minute. + * + * @return $this + */ + public function setMainTempoQpm(?float $main_tempo_qpm): static + { + if (is_null($main_tempo_qpm)) { + throw new InvalidArgumentException('non-nullable main_tempo_qpm cannot be null'); + } + $this->container['main_tempo_qpm'] = $main_tempo_qpm; + + return $this; + } + + /** + * Gets main_key_signature + * + * @return int|null + */ + public function getMainKeySignature(): ?int + { + return $this->container['main_key_signature']; + } + + /** + * Sets main_key_signature + * + * @param int|null $main_key_signature Main key signature as a fifths count (negative for flats, positive for sharps, 0 for C major / A minor). + * + * @return $this + */ + public function setMainKeySignature(?int $main_key_signature): static + { + if (is_null($main_key_signature)) { + throw new InvalidArgumentException('non-nullable main_key_signature cannot be null'); + } + $this->container['main_key_signature'] = $main_key_signature; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OmrInstrumentOverride.php b/src/Model/OmrInstrumentOverride.php new file mode 100644 index 0000000..8a07391 --- /dev/null +++ b/src/Model/OmrInstrumentOverride.php @@ -0,0 +1,579 @@ + + */ +class OmrInstrumentOverride implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OmrInstrumentOverride'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'index' => 'int', + 'instrument_id' => 'string', + 'part_name' => 'string', + 'transpose_key' => 'string', + 'midi_program' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'index' => null, + 'instrument_id' => null, + 'part_name' => null, + 'transpose_key' => null, + 'midi_program' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'index' => false, + 'instrument_id' => false, + 'part_name' => false, + 'transpose_key' => false, + 'midi_program' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'index' => 'index', + 'instrument_id' => 'instrumentId', + 'part_name' => 'partName', + 'transpose_key' => 'transposeKey', + 'midi_program' => 'midiProgram' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'index' => 'setIndex', + 'instrument_id' => 'setInstrumentId', + 'part_name' => 'setPartName', + 'transpose_key' => 'setTransposeKey', + 'midi_program' => 'setMidiProgram' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'index' => 'getIndex', + 'instrument_id' => 'getInstrumentId', + 'part_name' => 'getPartName', + 'transpose_key' => 'getTransposeKey', + 'midi_program' => 'getMidiProgram' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('index', $data ?? [], null); + $this->setIfExists('instrument_id', $data ?? [], null); + $this->setIfExists('part_name', $data ?? [], null); + $this->setIfExists('transpose_key', $data ?? [], null); + $this->setIfExists('midi_program', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['index'] === null) { + $invalidProperties[] = "'index' can't be null"; + } + if (($this->container['index'] < 0)) { + $invalidProperties[] = "invalid value for 'index', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['instrument_id']) && (mb_strlen($this->container['instrument_id']) > 100)) { + $invalidProperties[] = "invalid value for 'instrument_id', the character length must be smaller than or equal to 100."; + } + + if (!is_null($this->container['instrument_id']) && (mb_strlen($this->container['instrument_id']) < 1)) { + $invalidProperties[] = "invalid value for 'instrument_id', the character length must be bigger than or equal to 1."; + } + + if (!is_null($this->container['part_name']) && (mb_strlen($this->container['part_name']) > 200)) { + $invalidProperties[] = "invalid value for 'part_name', the character length must be smaller than or equal to 200."; + } + + if (!is_null($this->container['transpose_key']) && !preg_match("/^[A-G][b♭#♯]?$/", $this->container['transpose_key'])) { + $invalidProperties[] = "invalid value for 'transpose_key', must be conform to the pattern /^[A-G][b♭#♯]?$/."; + } + + if (!is_null($this->container['midi_program']) && ($this->container['midi_program'] > 127)) { + $invalidProperties[] = "invalid value for 'midi_program', must be smaller than or equal to 127."; + } + + if (!is_null($this->container['midi_program']) && ($this->container['midi_program'] < 0)) { + $invalidProperties[] = "invalid value for 'midi_program', must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets index + * + * @return int + */ + public function getIndex(): int + { + return $this->container['index']; + } + + /** + * Sets index + * + * @param int $index 0-based position of the part to override, matching the `index` of the detected part. + * + * @return $this + */ + public function setIndex(int $index): static + { + if (is_null($index)) { + throw new InvalidArgumentException('non-nullable index cannot be null'); + } + if (($index < 0)) { + throw new InvalidArgumentException('invalid value for $index when calling OmrInstrumentOverride., must be bigger than or equal to 0.'); + } + + $this->container['index'] = $index; + + return $this; + } + + /** + * Gets instrument_id + * + * @return string|null + */ + public function getInstrumentId(): ?string + { + return $this->container['instrument_id']; + } + + /** + * Sets instrument_id + * + * @param string|null $instrument_id Override the resolved instrument with this Flat instrument id, for example `brass.horn`. See the [Instrument IDs reference](https://flat.io/developers/docs/api/instruments) for valid values. Both the dotted `.` form (`brass.horn`) and the bare instrument key (`horn`) are accepted. Use this or `midiProgram`. Takes precedence over `midiProgram` when both are set. + * + * @return $this + */ + public function setInstrumentId(?string $instrument_id): static + { + if (is_null($instrument_id)) { + throw new InvalidArgumentException('non-nullable instrument_id cannot be null'); + } + if ((mb_strlen($instrument_id) > 100)) { + throw new InvalidArgumentException('invalid length for $instrument_id when calling OmrInstrumentOverride., must be smaller than or equal to 100.'); + } + if ((mb_strlen($instrument_id) < 1)) { + throw new InvalidArgumentException('invalid length for $instrument_id when calling OmrInstrumentOverride., must be bigger than or equal to 1.'); + } + + $this->container['instrument_id'] = $instrument_id; + + return $this; + } + + /** + * Gets part_name + * + * @return string|null + */ + public function getPartName(): ?string + { + return $this->container['part_name']; + } + + /** + * Sets part_name + * + * @param string|null $part_name Override the part name. + * + * @return $this + */ + public function setPartName(?string $part_name): static + { + if (is_null($part_name)) { + throw new InvalidArgumentException('non-nullable part_name cannot be null'); + } + if ((mb_strlen($part_name) > 200)) { + throw new InvalidArgumentException('invalid length for $part_name when calling OmrInstrumentOverride., must be smaller than or equal to 200.'); + } + + $this->container['part_name'] = $part_name; + + return $this; + } + + /** + * Gets transpose_key + * + * @return string|null + */ + public function getTransposeKey(): ?string + { + return $this->container['transpose_key']; + } + + /** + * Sets transpose_key + * + * @param string|null $transpose_key Override the transposition / written key: a pitch class as a letter `A`-`G` with an optional accidental. For example `F` for Horn in F or `Bb` for a B flat clarinet. The accidental may be ASCII `b` (flat) or `#` (sharp), or the Unicode music glyphs `♭` (U+266D) and `♯` (U+266F). Unicode accidentals are normalized to their ASCII equivalent, so `B♭` is stored and returned as `Bb`. + * + * @return $this + */ + public function setTransposeKey(?string $transpose_key): static + { + if (is_null($transpose_key)) { + throw new InvalidArgumentException('non-nullable transpose_key cannot be null'); + } + + if ((!preg_match("/^[A-G][b♭#♯]?$/", ObjectSerializer::toString($transpose_key)))) { + throw new InvalidArgumentException("invalid value for \$transpose_key when calling OmrInstrumentOverride., must conform to the pattern /^[A-G][b♭#♯]?$/."); + } + + $this->container['transpose_key'] = $transpose_key; + + return $this; + } + + /** + * Gets midi_program + * + * @return int|null + */ + public function getMidiProgram(): ?int + { + return $this->container['midi_program']; + } + + /** + * Sets midi_program + * + * @param int|null $midi_program Override the instrument with a standard General MIDI program number (0-127), resolved server-side to the matching Flat instrument. Use this when you do not want to map Flat instrument ids. Ignored if `instrumentId` is also set. + * + * @return $this + */ + public function setMidiProgram(?int $midi_program): static + { + if (is_null($midi_program)) { + throw new InvalidArgumentException('non-nullable midi_program cannot be null'); + } + if (($midi_program > 127)) { + throw new InvalidArgumentException('invalid value for $midi_program when calling OmrInstrumentOverride., must be smaller than or equal to 127.'); + } + if (($midi_program < 0)) { + throw new InvalidArgumentException('invalid value for $midi_program when calling OmrInstrumentOverride., must be bigger than or equal to 0.'); + } + + $this->container['midi_program'] = $midi_program; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OmrJob.php b/src/Model/OmrJob.php new file mode 100644 index 0000000..3ab630f --- /dev/null +++ b/src/Model/OmrJob.php @@ -0,0 +1,940 @@ + + */ +class OmrJob implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OmrJob'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'status' => '\Flat\APIClient\Model\OmrJobStatus', + 'output' => '\Flat\APIClient\Model\OmrJobOutput', + 'interactive_steps' => '\Flat\APIClient\Model\OmrStepName[]', + 'locales' => 'string[]', + 'current_step' => '\Flat\APIClient\Model\OmrStepName', + 'pending_step' => '\Flat\APIClient\Model\OmrPendingStep', + 'estimated_credits' => 'int', + 'progress' => '\Flat\APIClient\Model\OmrJobProgress', + 'original_file_metadata' => '\Flat\APIClient\Model\OmrJobFileMetadata', + 'imported_metadata' => '\Flat\APIClient\Model\OmrImportedMetadata', + 'result' => '\Flat\APIClient\Model\OmrJobResult', + 'retention' => '\Flat\APIClient\Model\OmrJobRetention', + 'error_code' => 'string', + 'error_message' => 'string', + 'creation_date' => '\DateTime', + 'modification_date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'status' => null, + 'output' => null, + 'interactive_steps' => null, + 'locales' => null, + 'current_step' => null, + 'pending_step' => null, + 'estimated_credits' => null, + 'progress' => null, + 'original_file_metadata' => null, + 'imported_metadata' => null, + 'result' => null, + 'retention' => null, + 'error_code' => null, + 'error_message' => null, + 'creation_date' => 'date-time', + 'modification_date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'status' => false, + 'output' => false, + 'interactive_steps' => false, + 'locales' => false, + 'current_step' => false, + 'pending_step' => false, + 'estimated_credits' => false, + 'progress' => false, + 'original_file_metadata' => false, + 'imported_metadata' => false, + 'result' => false, + 'retention' => false, + 'error_code' => false, + 'error_message' => false, + 'creation_date' => false, + 'modification_date' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'status' => 'status', + 'output' => 'output', + 'interactive_steps' => 'interactiveSteps', + 'locales' => 'locales', + 'current_step' => 'currentStep', + 'pending_step' => 'pendingStep', + 'estimated_credits' => 'estimatedCredits', + 'progress' => 'progress', + 'original_file_metadata' => 'originalFileMetadata', + 'imported_metadata' => 'importedMetadata', + 'result' => 'result', + 'retention' => 'retention', + 'error_code' => 'errorCode', + 'error_message' => 'errorMessage', + 'creation_date' => 'creationDate', + 'modification_date' => 'modificationDate' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'status' => 'setStatus', + 'output' => 'setOutput', + 'interactive_steps' => 'setInteractiveSteps', + 'locales' => 'setLocales', + 'current_step' => 'setCurrentStep', + 'pending_step' => 'setPendingStep', + 'estimated_credits' => 'setEstimatedCredits', + 'progress' => 'setProgress', + 'original_file_metadata' => 'setOriginalFileMetadata', + 'imported_metadata' => 'setImportedMetadata', + 'result' => 'setResult', + 'retention' => 'setRetention', + 'error_code' => 'setErrorCode', + 'error_message' => 'setErrorMessage', + 'creation_date' => 'setCreationDate', + 'modification_date' => 'setModificationDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'status' => 'getStatus', + 'output' => 'getOutput', + 'interactive_steps' => 'getInteractiveSteps', + 'locales' => 'getLocales', + 'current_step' => 'getCurrentStep', + 'pending_step' => 'getPendingStep', + 'estimated_credits' => 'getEstimatedCredits', + 'progress' => 'getProgress', + 'original_file_metadata' => 'getOriginalFileMetadata', + 'imported_metadata' => 'getImportedMetadata', + 'result' => 'getResult', + 'retention' => 'getRetention', + 'error_code' => 'getErrorCode', + 'error_message' => 'getErrorMessage', + 'creation_date' => 'getCreationDate', + 'modification_date' => 'getModificationDate' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('output', $data ?? [], null); + $this->setIfExists('interactive_steps', $data ?? [], null); + $this->setIfExists('locales', $data ?? [], null); + $this->setIfExists('current_step', $data ?? [], null); + $this->setIfExists('pending_step', $data ?? [], null); + $this->setIfExists('estimated_credits', $data ?? [], null); + $this->setIfExists('progress', $data ?? [], null); + $this->setIfExists('original_file_metadata', $data ?? [], null); + $this->setIfExists('imported_metadata', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('retention', $data ?? [], null); + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('error_message', $data ?? [], null); + $this->setIfExists('creation_date', $data ?? [], null); + $this->setIfExists('modification_date', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + if ($this->container['output'] === null) { + $invalidProperties[] = "'output' can't be null"; + } + if ($this->container['interactive_steps'] === null) { + $invalidProperties[] = "'interactive_steps' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Unique identifier of the OMR job. + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets status + * + * @return \Flat\APIClient\Model\OmrJobStatus + */ + public function getStatus(): \Flat\APIClient\Model\OmrJobStatus + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Flat\APIClient\Model\OmrJobStatus $status status + * + * @return $this + */ + public function setStatus(\Flat\APIClient\Model\OmrJobStatus $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets output + * + * @return \Flat\APIClient\Model\OmrJobOutput + */ + public function getOutput(): \Flat\APIClient\Model\OmrJobOutput + { + return $this->container['output']; + } + + /** + * Sets output + * + * @param \Flat\APIClient\Model\OmrJobOutput $output output + * + * @return $this + */ + public function setOutput(\Flat\APIClient\Model\OmrJobOutput $output): static + { + if (is_null($output)) { + throw new InvalidArgumentException('non-nullable output cannot be null'); + } + $this->container['output'] = $output; + + return $this; + } + + /** + * Gets interactive_steps + * + * @return \Flat\APIClient\Model\OmrStepName[] + */ + public function getInteractiveSteps(): array + { + return $this->container['interactive_steps']; + } + + /** + * Sets interactive_steps + * + * @param \Flat\APIClient\Model\OmrStepName[] $interactive_steps Steps this job pauses at for client input, echoing the value set at creation. + * + * @return $this + */ + public function setInteractiveSteps(array $interactive_steps): static + { + if (is_null($interactive_steps)) { + throw new InvalidArgumentException('non-nullable interactive_steps cannot be null'); + } + $this->container['interactive_steps'] = $interactive_steps; + + return $this; + } + + /** + * Gets locales + * + * @return string[]|null + */ + public function getLocales(): ?array + { + return $this->container['locales']; + } + + /** + * Sets locales + * + * @param string[]|null $locales Locale hints (BCP 47) the job was created with, used for OCR and as the default main language at the `details` step. + * + * @return $this + */ + public function setLocales(?array $locales): static + { + if (is_null($locales)) { + throw new InvalidArgumentException('non-nullable locales cannot be null'); + } + $this->container['locales'] = $locales; + + return $this; + } + + /** + * Gets current_step + * + * @return \Flat\APIClient\Model\OmrStepName|null + */ + public function getCurrentStep(): ?\Flat\APIClient\Model\OmrStepName + { + return $this->container['current_step']; + } + + /** + * Sets current_step + * + * @param \Flat\APIClient\Model\OmrStepName|null $current_step The pending step when `status` is `awaitingInput`. Omitted otherwise. + * + * @return $this + */ + public function setCurrentStep(?\Flat\APIClient\Model\OmrStepName $current_step): static + { + if (is_null($current_step)) { + throw new InvalidArgumentException('non-nullable current_step cannot be null'); + } + $this->container['current_step'] = $current_step; + + return $this; + } + + /** + * Gets pending_step + * + * @return \Flat\APIClient\Model\OmrPendingStep|null + */ + public function getPendingStep(): ?\Flat\APIClient\Model\OmrPendingStep + { + return $this->container['pending_step']; + } + + /** + * Sets pending_step + * + * @param \Flat\APIClient\Model\OmrPendingStep|null $pending_step pending_step + * + * @return $this + */ + public function setPendingStep(?\Flat\APIClient\Model\OmrPendingStep $pending_step): static + { + if (is_null($pending_step)) { + throw new InvalidArgumentException('non-nullable pending_step cannot be null'); + } + $this->container['pending_step'] = $pending_step; + + return $this; + } + + /** + * Gets estimated_credits + * + * @return int|null + */ + public function getEstimatedCredits(): ?int + { + return $this->container['estimated_credits']; + } + + /** + * Sets estimated_credits + * + * @param int|null $estimated_credits Credits that will be or were charged at start (page-based), so a client can show a confirmation before charging. + * + * @return $this + */ + public function setEstimatedCredits(?int $estimated_credits): static + { + if (is_null($estimated_credits)) { + throw new InvalidArgumentException('non-nullable estimated_credits cannot be null'); + } + $this->container['estimated_credits'] = $estimated_credits; + + return $this; + } + + /** + * Gets progress + * + * @return \Flat\APIClient\Model\OmrJobProgress|null + */ + public function getProgress(): ?\Flat\APIClient\Model\OmrJobProgress + { + return $this->container['progress']; + } + + /** + * Sets progress + * + * @param \Flat\APIClient\Model\OmrJobProgress|null $progress progress + * + * @return $this + */ + public function setProgress(?\Flat\APIClient\Model\OmrJobProgress $progress): static + { + if (is_null($progress)) { + throw new InvalidArgumentException('non-nullable progress cannot be null'); + } + $this->container['progress'] = $progress; + + return $this; + } + + /** + * Gets original_file_metadata + * + * @return \Flat\APIClient\Model\OmrJobFileMetadata|null + */ + public function getOriginalFileMetadata(): ?\Flat\APIClient\Model\OmrJobFileMetadata + { + return $this->container['original_file_metadata']; + } + + /** + * Sets original_file_metadata + * + * @param \Flat\APIClient\Model\OmrJobFileMetadata|null $original_file_metadata original_file_metadata + * + * @return $this + */ + public function setOriginalFileMetadata(?\Flat\APIClient\Model\OmrJobFileMetadata $original_file_metadata): static + { + if (is_null($original_file_metadata)) { + throw new InvalidArgumentException('non-nullable original_file_metadata cannot be null'); + } + $this->container['original_file_metadata'] = $original_file_metadata; + + return $this; + } + + /** + * Gets imported_metadata + * + * @return \Flat\APIClient\Model\OmrImportedMetadata|null + */ + public function getImportedMetadata(): ?\Flat\APIClient\Model\OmrImportedMetadata + { + return $this->container['imported_metadata']; + } + + /** + * Sets imported_metadata + * + * @param \Flat\APIClient\Model\OmrImportedMetadata|null $imported_metadata imported_metadata + * + * @return $this + */ + public function setImportedMetadata(?\Flat\APIClient\Model\OmrImportedMetadata $imported_metadata): static + { + if (is_null($imported_metadata)) { + throw new InvalidArgumentException('non-nullable imported_metadata cannot be null'); + } + $this->container['imported_metadata'] = $imported_metadata; + + return $this; + } + + /** + * Gets result + * + * @return \Flat\APIClient\Model\OmrJobResult|null + */ + public function getResult(): ?\Flat\APIClient\Model\OmrJobResult + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \Flat\APIClient\Model\OmrJobResult|null $result result + * + * @return $this + */ + public function setResult(?\Flat\APIClient\Model\OmrJobResult $result): static + { + if (is_null($result)) { + throw new InvalidArgumentException('non-nullable result cannot be null'); + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets retention + * + * @return \Flat\APIClient\Model\OmrJobRetention|null + */ + public function getRetention(): ?\Flat\APIClient\Model\OmrJobRetention + { + return $this->container['retention']; + } + + /** + * Sets retention + * + * @param \Flat\APIClient\Model\OmrJobRetention|null $retention retention + * + * @return $this + */ + public function setRetention(?\Flat\APIClient\Model\OmrJobRetention $retention): static + { + if (is_null($retention)) { + throw new InvalidArgumentException('non-nullable retention cannot be null'); + } + $this->container['retention'] = $retention; + + return $this; + } + + /** + * Gets error_code + * + * @return string|null + */ + public function getErrorCode(): ?string + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param string|null $error_code Stable, engine-agnostic failure code, present when `status` is `error`. Branch on this for custom handling, and render `errorMessage` for the user-facing text. This is an open string: new codes may be added over time, so keep a generic fallback and never hardcode an exhaustive switch. Current values: * `NO_MUSIC_DETECTED`: no musical content found (poor scan, rotated page, or tablature). * `CORRUPTED_FILE`: the input file is corrupted and could not be read. * `UNSUPPORTED_FORMAT`: the file format or notation is not supported yet. * `UNSUPPORTED_TABLATURE`: the file is guitar tablature, not supported yet. * `ENCRYPTED_PDF`: the PDF is password-protected. * `TOO_LARGE`: the document is too large or has an unusual shape to process. * `ENGINE_TIMEOUT`: recognition took longer than expected and was stopped. * `GENERIC`: unspecified failure. + * + * @return $this + */ + public function setErrorCode(?string $error_code): static + { + if (is_null($error_code)) { + throw new InvalidArgumentException('non-nullable error_code cannot be null'); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets error_message + * + * @return string|null + */ + public function getErrorMessage(): ?string + { + return $this->container['error_message']; + } + + /** + * Sets error_message + * + * @param string|null $error_message Localized, user-facing error message, present when `status` is `error`. Rendered in the caller's locale and safe to display as-is. Pair with `errorCode` for branching. + * + * @return $this + */ + public function setErrorMessage(?string $error_message): static + { + if (is_null($error_message)) { + throw new InvalidArgumentException('non-nullable error_message cannot be null'); + } + $this->container['error_message'] = $error_message; + + return $this; + } + + /** + * Gets creation_date + * + * @return \DateTime|null + */ + public function getCreationDate(): ?\DateTime + { + return $this->container['creation_date']; + } + + /** + * Sets creation_date + * + * @param \DateTime|null $creation_date When the job was created. + * + * @return $this + */ + public function setCreationDate(?\DateTime $creation_date): static + { + if (is_null($creation_date)) { + throw new InvalidArgumentException('non-nullable creation_date cannot be null'); + } + $this->container['creation_date'] = $creation_date; + + return $this; + } + + /** + * Gets modification_date + * + * @return \DateTime|null + */ + public function getModificationDate(): ?\DateTime + { + return $this->container['modification_date']; + } + + /** + * Sets modification_date + * + * @param \DateTime|null $modification_date When the job was last updated. + * + * @return $this + */ + public function setModificationDate(?\DateTime $modification_date): static + { + if (is_null($modification_date)) { + throw new InvalidArgumentException('non-nullable modification_date cannot be null'); + } + $this->container['modification_date'] = $modification_date; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OmrJobCreation.php b/src/Model/OmrJobCreation.php new file mode 100644 index 0000000..10de61a --- /dev/null +++ b/src/Model/OmrJobCreation.php @@ -0,0 +1,589 @@ + + */ +class OmrJobCreation implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OmrJobCreation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'output' => '\Flat\APIClient\Model\OmrJobOutput', + 'interactive_steps' => '\Flat\APIClient\Model\OmrStepName[]', + 'locales' => 'string[]', + 'collection' => 'string', + 'idempotency_key' => 'string', + 'files' => '\Flat\APIClient\Model\OmrJobInputFile[]', + 'auto_start' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'output' => null, + 'interactive_steps' => null, + 'locales' => null, + 'collection' => null, + 'idempotency_key' => null, + 'files' => null, + 'auto_start' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'output' => false, + 'interactive_steps' => false, + 'locales' => false, + 'collection' => false, + 'idempotency_key' => false, + 'files' => false, + 'auto_start' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'output' => 'output', + 'interactive_steps' => 'interactiveSteps', + 'locales' => 'locales', + 'collection' => 'collection', + 'idempotency_key' => 'idempotencyKey', + 'files' => 'files', + 'auto_start' => 'autoStart' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'output' => 'setOutput', + 'interactive_steps' => 'setInteractiveSteps', + 'locales' => 'setLocales', + 'collection' => 'setCollection', + 'idempotency_key' => 'setIdempotencyKey', + 'files' => 'setFiles', + 'auto_start' => 'setAutoStart' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'output' => 'getOutput', + 'interactive_steps' => 'getInteractiveSteps', + 'locales' => 'getLocales', + 'collection' => 'getCollection', + 'idempotency_key' => 'getIdempotencyKey', + 'files' => 'getFiles', + 'auto_start' => 'getAutoStart' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('output', $data ?? [], null); + $this->setIfExists('interactive_steps', $data ?? [], []); + $this->setIfExists('locales', $data ?? [], null); + $this->setIfExists('collection', $data ?? [], null); + $this->setIfExists('idempotency_key', $data ?? [], null); + $this->setIfExists('files', $data ?? [], null); + $this->setIfExists('auto_start', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets output + * + * @return \Flat\APIClient\Model\OmrJobOutput|null + */ + public function getOutput(): ?\Flat\APIClient\Model\OmrJobOutput + { + return $this->container['output']; + } + + /** + * Sets output + * + * @param \Flat\APIClient\Model\OmrJobOutput|null $output output + * + * @return $this + */ + public function setOutput(?\Flat\APIClient\Model\OmrJobOutput $output): static + { + if (is_null($output)) { + throw new InvalidArgumentException('non-nullable output cannot be null'); + } + $this->container['output'] = $output; + + return $this; + } + + /** + * Gets interactive_steps + * + * @return \Flat\APIClient\Model\OmrStepName[]|null + */ + public function getInteractiveSteps(): ?array + { + return $this->container['interactive_steps']; + } + + /** + * Sets interactive_steps + * + * @param \Flat\APIClient\Model\OmrStepName[]|null $interactive_steps Steps at which the pipeline should pause for this client. Omit or send `[]` for a fully automatic import. The server only pauses at the steps listed here; declare only steps your client can actually render. + * + * @return $this + */ + public function setInteractiveSteps(?array $interactive_steps): static + { + if (is_null($interactive_steps)) { + throw new InvalidArgumentException('non-nullable interactive_steps cannot be null'); + } + $this->container['interactive_steps'] = $interactive_steps; + + return $this; + } + + /** + * Gets locales + * + * @return string[]|null + */ + public function getLocales(): ?array + { + return $this->container['locales']; + } + + /** + * Sets locales + * + * @param string[]|null $locales Locale hints (BCP 47) to improve text and lyric detection, for example `[\"ja\", \"en\"]`. The first entry drives the OCR reader. This is the input hint; the detected main language is confirmed later at the `details` step. + * + * @return $this + */ + public function setLocales(?array $locales): static + { + if (is_null($locales)) { + throw new InvalidArgumentException('non-nullable locales cannot be null'); + } + $this->container['locales'] = $locales; + + return $this; + } + + /** + * Gets collection + * + * @return string|null + */ + public function getCollection(): ?string + { + return $this->container['collection']; + } + + /** + * Sets collection + * + * @param string|null $collection Target collection ID. Only used when `output` is `library`. + * + * @return $this + */ + public function setCollection(?string $collection): static + { + if (is_null($collection)) { + throw new InvalidArgumentException('non-nullable collection cannot be null'); + } + $this->container['collection'] = $collection; + + return $this; + } + + /** + * Gets idempotency_key + * + * @return string|null + */ + public function getIdempotencyKey(): ?string + { + return $this->container['idempotency_key']; + } + + /** + * Sets idempotency_key + * + * @param string|null $idempotency_key Optional client-supplied key. A retry with the same key returns the existing job instead of creating a duplicate, for safe retries on flaky networks. + * + * @return $this + */ + public function setIdempotencyKey(?string $idempotency_key): static + { + if (is_null($idempotency_key)) { + throw new InvalidArgumentException('non-nullable idempotency_key cannot be null'); + } + $this->container['idempotency_key'] = $idempotency_key; + + return $this; + } + + /** + * Gets files + * + * @return \Flat\APIClient\Model\OmrJobInputFile[]|null + */ + public function getFiles(): ?array + { + return $this->container['files']; + } + + /** + * Sets files + * + * @param \Flat\APIClient\Model\OmrJobInputFile[]|null $files Optional inline inputs for a one-shot import. For multi-image or mobile capture, omit this and use `addOmrJobFile`. + * + * @return $this + */ + public function setFiles(?array $files): static + { + if (is_null($files)) { + throw new InvalidArgumentException('non-nullable files cannot be null'); + } + $this->container['files'] = $files; + + return $this; + } + + /** + * Gets auto_start + * + * @return bool|null + */ + public function getAutoStart(): ?bool + { + return $this->container['auto_start']; + } + + /** + * Sets auto_start + * + * @param bool|null $auto_start Start processing immediately. Only valid when `files` is provided. + * + * @return $this + */ + public function setAutoStart(?bool $auto_start): static + { + if (is_null($auto_start)) { + throw new InvalidArgumentException('non-nullable auto_start cannot be null'); + } + $this->container['auto_start'] = $auto_start; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OmrJobFileMetadata.php b/src/Model/OmrJobFileMetadata.php new file mode 100644 index 0000000..ca65a9f --- /dev/null +++ b/src/Model/OmrJobFileMetadata.php @@ -0,0 +1,555 @@ + + */ +class OmrJobFileMetadata implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OmrJobFileMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'number_of_pages' => 'int', + 'file_count' => 'int', + 'filename' => 'string', + 'file_size' => 'int', + 'mime_type' => 'string', + 'file_extension' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'number_of_pages' => null, + 'file_count' => null, + 'filename' => null, + 'file_size' => null, + 'mime_type' => null, + 'file_extension' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'number_of_pages' => false, + 'file_count' => false, + 'filename' => false, + 'file_size' => false, + 'mime_type' => false, + 'file_extension' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'number_of_pages' => 'numberOfPages', + 'file_count' => 'fileCount', + 'filename' => 'filename', + 'file_size' => 'fileSize', + 'mime_type' => 'mimeType', + 'file_extension' => 'fileExtension' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'number_of_pages' => 'setNumberOfPages', + 'file_count' => 'setFileCount', + 'filename' => 'setFilename', + 'file_size' => 'setFileSize', + 'mime_type' => 'setMimeType', + 'file_extension' => 'setFileExtension' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'number_of_pages' => 'getNumberOfPages', + 'file_count' => 'getFileCount', + 'filename' => 'getFilename', + 'file_size' => 'getFileSize', + 'mime_type' => 'getMimeType', + 'file_extension' => 'getFileExtension' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('number_of_pages', $data ?? [], null); + $this->setIfExists('file_count', $data ?? [], null); + $this->setIfExists('filename', $data ?? [], null); + $this->setIfExists('file_size', $data ?? [], null); + $this->setIfExists('mime_type', $data ?? [], null); + $this->setIfExists('file_extension', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets number_of_pages + * + * @return int|null + */ + public function getNumberOfPages(): ?int + { + return $this->container['number_of_pages']; + } + + /** + * Sets number_of_pages + * + * @param int|null $number_of_pages Total number of pages across all input files. + * + * @return $this + */ + public function setNumberOfPages(?int $number_of_pages): static + { + if (is_null($number_of_pages)) { + throw new InvalidArgumentException('non-nullable number_of_pages cannot be null'); + } + $this->container['number_of_pages'] = $number_of_pages; + + return $this; + } + + /** + * Gets file_count + * + * @return int|null + */ + public function getFileCount(): ?int + { + return $this->container['file_count']; + } + + /** + * Sets file_count + * + * @param int|null $file_count Number of input files attached. + * + * @return $this + */ + public function setFileCount(?int $file_count): static + { + if (is_null($file_count)) { + throw new InvalidArgumentException('non-nullable file_count cannot be null'); + } + $this->container['file_count'] = $file_count; + + return $this; + } + + /** + * Gets filename + * + * @return string|null + */ + public function getFilename(): ?string + { + return $this->container['filename']; + } + + /** + * Sets filename + * + * @param string|null $filename Original filename of the input as uploaded (of the first file when several were combined). + * + * @return $this + */ + public function setFilename(?string $filename): static + { + if (is_null($filename)) { + throw new InvalidArgumentException('non-nullable filename cannot be null'); + } + $this->container['filename'] = $filename; + + return $this; + } + + /** + * Gets file_size + * + * @return int|null + */ + public function getFileSize(): ?int + { + return $this->container['file_size']; + } + + /** + * Sets file_size + * + * @param int|null $file_size Combined size of the input files, in bytes. + * + * @return $this + */ + public function setFileSize(?int $file_size): static + { + if (is_null($file_size)) { + throw new InvalidArgumentException('non-nullable file_size cannot be null'); + } + $this->container['file_size'] = $file_size; + + return $this; + } + + /** + * Gets mime_type + * + * @return string|null + */ + public function getMimeType(): ?string + { + return $this->container['mime_type']; + } + + /** + * Sets mime_type + * + * @param string|null $mime_type MIME type of the input (of the first file when several were combined). + * + * @return $this + */ + public function setMimeType(?string $mime_type): static + { + if (is_null($mime_type)) { + throw new InvalidArgumentException('non-nullable mime_type cannot be null'); + } + $this->container['mime_type'] = $mime_type; + + return $this; + } + + /** + * Gets file_extension + * + * @return string|null + */ + public function getFileExtension(): ?string + { + return $this->container['file_extension']; + } + + /** + * Sets file_extension + * + * @param string|null $file_extension File extension of the input, without the leading dot (for example `pdf`). + * + * @return $this + */ + public function setFileExtension(?string $file_extension): static + { + if (is_null($file_extension)) { + throw new InvalidArgumentException('non-nullable file_extension cannot be null'); + } + $this->container['file_extension'] = $file_extension; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OmrJobFileUpload.php b/src/Model/OmrJobFileUpload.php new file mode 100644 index 0000000..eaa96c5 --- /dev/null +++ b/src/Model/OmrJobFileUpload.php @@ -0,0 +1,422 @@ + + */ +class OmrJobFileUpload implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OmrJobFileUpload'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'file' => 'string', + 'filename' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'file' => 'byte', + 'filename' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'file' => false, + 'filename' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'file' => 'file', + 'filename' => 'filename' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'file' => 'setFile', + 'filename' => 'setFilename' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'file' => 'getFile', + 'filename' => 'getFilename' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('file', $data ?? [], null); + $this->setIfExists('filename', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['file'] === null) { + $invalidProperties[] = "'file' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets file + * + * @return string + */ + public function getFile(): string + { + return $this->container['file']; + } + + /** + * Sets file + * + * @param string $file File data, base64-encoded. The type is read from the content itself, so no declared MIME type or filename extension is needed. Accepted types are listed by `getOmrCapabilities` in `acceptedMimeTypes`. + * + * @return $this + */ + public function setFile(string $file): static + { + if (is_null($file)) { + throw new InvalidArgumentException('non-nullable file cannot be null'); + } + $this->container['file'] = $file; + + return $this; + } + + /** + * Gets filename + * + * @return string|null + */ + public function getFilename(): ?string + { + return $this->container['filename']; + } + + /** + * Sets filename + * + * @param string|null $filename Optional original filename, kept for display. + * + * @return $this + */ + public function setFilename(?string $filename): static + { + if (is_null($filename)) { + throw new InvalidArgumentException('non-nullable filename cannot be null'); + } + $this->container['filename'] = $filename; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OmrJobFileUploadResult.php b/src/Model/OmrJobFileUploadResult.php new file mode 100644 index 0000000..6916fa2 --- /dev/null +++ b/src/Model/OmrJobFileUploadResult.php @@ -0,0 +1,419 @@ + + */ +class OmrJobFileUploadResult implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OmrJobFileUploadResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'file_index' => 'int', + 'file_count' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'file_index' => null, + 'file_count' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'file_index' => false, + 'file_count' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'file_index' => 'fileIndex', + 'file_count' => 'fileCount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'file_index' => 'setFileIndex', + 'file_count' => 'setFileCount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'file_index' => 'getFileIndex', + 'file_count' => 'getFileCount' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('file_index', $data ?? [], null); + $this->setIfExists('file_count', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets file_index + * + * @return int|null + */ + public function getFileIndex(): ?int + { + return $this->container['file_index']; + } + + /** + * Sets file_index + * + * @param int|null $file_index 0-based index assigned to the uploaded file. + * + * @return $this + */ + public function setFileIndex(?int $file_index): static + { + if (is_null($file_index)) { + throw new InvalidArgumentException('non-nullable file_index cannot be null'); + } + $this->container['file_index'] = $file_index; + + return $this; + } + + /** + * Gets file_count + * + * @return int|null + */ + public function getFileCount(): ?int + { + return $this->container['file_count']; + } + + /** + * Sets file_count + * + * @param int|null $file_count Total number of files now attached to the job. + * + * @return $this + */ + public function setFileCount(?int $file_count): static + { + if (is_null($file_count)) { + throw new InvalidArgumentException('non-nullable file_count cannot be null'); + } + $this->container['file_count'] = $file_count; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OmrJobInputFile.php b/src/Model/OmrJobInputFile.php new file mode 100644 index 0000000..82cab4b --- /dev/null +++ b/src/Model/OmrJobInputFile.php @@ -0,0 +1,422 @@ + + */ +class OmrJobInputFile implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OmrJobInputFile'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'file' => 'string', + 'filename' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'file' => 'byte', + 'filename' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'file' => false, + 'filename' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'file' => 'file', + 'filename' => 'filename' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'file' => 'setFile', + 'filename' => 'setFilename' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'file' => 'getFile', + 'filename' => 'getFilename' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('file', $data ?? [], null); + $this->setIfExists('filename', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['file'] === null) { + $invalidProperties[] = "'file' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets file + * + * @return string + */ + public function getFile(): string + { + return $this->container['file']; + } + + /** + * Sets file + * + * @param string $file File data, base64-encoded. The type is read from the content itself, so no declared MIME type or filename extension is needed. Accepted types are listed by `getOmrCapabilities` in `acceptedMimeTypes`. + * + * @return $this + */ + public function setFile(string $file): static + { + if (is_null($file)) { + throw new InvalidArgumentException('non-nullable file cannot be null'); + } + $this->container['file'] = $file; + + return $this; + } + + /** + * Gets filename + * + * @return string|null + */ + public function getFilename(): ?string + { + return $this->container['filename']; + } + + /** + * Sets filename + * + * @param string|null $filename Optional original filename, kept for display. + * + * @return $this + */ + public function setFilename(?string $filename): static + { + if (is_null($filename)) { + throw new InvalidArgumentException('non-nullable filename cannot be null'); + } + $this->container['filename'] = $filename; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OmrJobOutput.php b/src/Model/OmrJobOutput.php new file mode 100644 index 0000000..3f2182e --- /dev/null +++ b/src/Model/OmrJobOutput.php @@ -0,0 +1,46 @@ + + */ +class OmrJobProgress implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OmrJobProgress'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'percent' => 'float', + 'text' => 'string', + 'key' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'percent' => null, + 'text' => null, + 'key' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'percent' => false, + 'text' => false, + 'key' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'percent' => 'percent', + 'text' => 'text', + 'key' => 'key' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'percent' => 'setPercent', + 'text' => 'setText', + 'key' => 'setKey' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'percent' => 'getPercent', + 'text' => 'getText', + 'key' => 'getKey' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('percent', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('key', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets percent + * + * @return float|null + */ + public function getPercent(): ?float + { + return $this->container['percent']; + } + + /** + * Sets percent + * + * @param float|null $percent Completion percentage (0-100). + * + * @return $this + */ + public function setPercent(?float $percent): static + { + if (is_null($percent)) { + throw new InvalidArgumentException('non-nullable percent cannot be null'); + } + $this->container['percent'] = $percent; + + return $this; + } + + /** + * Gets text + * + * @return string|null + */ + public function getText(): ?string + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string|null $text Localized progress message, ready to display. + * + * @return $this + */ + public function setText(?string $text): static + { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets key + * + * @return string|null + */ + public function getKey(): ?string + { + return $this->container['key']; + } + + /** + * Sets key + * + * @param string|null $key Stable progress key (for example `OMR_QUEUED`, `OMR_PROCESSING_PAGE`, `OMR_CREATING_SCORE`), for matching the current phase in a stepper UI independent of locale. + * + * @return $this + */ + public function setKey(?string $key): static + { + if (is_null($key)) { + throw new InvalidArgumentException('non-nullable key cannot be null'); + } + $this->container['key'] = $key; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OmrJobResult.php b/src/Model/OmrJobResult.php new file mode 100644 index 0000000..1cc3252 --- /dev/null +++ b/src/Model/OmrJobResult.php @@ -0,0 +1,419 @@ + + */ +class OmrJobResult implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OmrJobResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'score' => 'string', + 'exports' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'score' => null, + 'exports' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'score' => false, + 'exports' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'score' => 'score', + 'exports' => 'exports' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'score' => 'setScore', + 'exports' => 'setExports' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'score' => 'getScore', + 'exports' => 'getExports' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('score', $data ?? [], null); + $this->setIfExists('exports', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets score + * + * @return string|null + */ + public function getScore(): ?string + { + return $this->container['score']; + } + + /** + * Sets score + * + * @param string|null $score Created score ID, when `output` is `library`. + * + * @return $this + */ + public function setScore(?string $score): static + { + if (is_null($score)) { + throw new InvalidArgumentException('non-nullable score cannot be null'); + } + $this->container['score'] = $score; + + return $this; + } + + /** + * Gets exports + * + * @return string[]|null + */ + public function getExports(): ?array + { + return $this->container['exports']; + } + + /** + * Sets exports + * + * @param string[]|null $exports Formats available via `getOmrJobExport`, for example `[\"musicxml\", \"mxl\", \"midi\"]`. + * + * @return $this + */ + public function setExports(?array $exports): static + { + if (is_null($exports)) { + throw new InvalidArgumentException('non-nullable exports cannot be null'); + } + $this->container['exports'] = $exports; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OmrJobRetention.php b/src/Model/OmrJobRetention.php new file mode 100644 index 0000000..2c8638e --- /dev/null +++ b/src/Model/OmrJobRetention.php @@ -0,0 +1,422 @@ + + */ +class OmrJobRetention implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OmrJobRetention'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'expiry_date' => '\DateTime', + 'expired_date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'expiry_date' => 'date-time', + 'expired_date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'expiry_date' => false, + 'expired_date' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'expiry_date' => 'expiryDate', + 'expired_date' => 'expiredDate' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'expiry_date' => 'setExpiryDate', + 'expired_date' => 'setExpiredDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'expiry_date' => 'getExpiryDate', + 'expired_date' => 'getExpiredDate' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('expiry_date', $data ?? [], null); + $this->setIfExists('expired_date', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['expiry_date'] === null) { + $invalidProperties[] = "'expiry_date' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets expiry_date + * + * @return \DateTime + */ + public function getExpiryDate(): \DateTime + { + return $this->container['expiry_date']; + } + + /** + * Sets expiry_date + * + * @param \DateTime $expiry_date When this job's uploaded files and recognition results become eligible for erasure. Fixed when the job is created: changing the account's retention period does not move the deadline of jobs that already exist. + * + * @return $this + */ + public function setExpiryDate(\DateTime $expiry_date): static + { + if (is_null($expiry_date)) { + throw new InvalidArgumentException('non-nullable expiry_date cannot be null'); + } + $this->container['expiry_date'] = $expiry_date; + + return $this; + } + + /** + * Gets expired_date + * + * @return \DateTime|null + */ + public function getExpiredDate(): ?\DateTime + { + return $this->container['expired_date']; + } + + /** + * Sets expired_date + * + * @param \DateTime|null $expired_date When the job's stored files were actually erased. Present only once that happened. An expired job keeps the `status` it finished with and stays listable, but its `result` is no longer served and downloads fail with `OMR_JOB_EXPIRED`. + * + * @return $this + */ + public function setExpiredDate(?\DateTime $expired_date): static + { + if (is_null($expired_date)) { + throw new InvalidArgumentException('non-nullable expired_date cannot be null'); + } + $this->container['expired_date'] = $expired_date; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OmrJobStatus.php b/src/Model/OmrJobStatus.php new file mode 100644 index 0000000..05bfac2 --- /dev/null +++ b/src/Model/OmrJobStatus.php @@ -0,0 +1,54 @@ + + */ +class OmrLocaleDetails implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OmrLocaleDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'code' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'code' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'code' => false, + 'name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'code' => 'code', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'code' => 'setCode', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'code' => 'getCode', + 'name' => 'getName' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['code'] === null) { + $invalidProperties[] = "'code' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets code + * + * @return string + */ + public function getCode(): string + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string $code BCP 47 locale code. Always one of the codes listed in `locales`. + * + * @return $this + */ + public function setCode(string $code): static + { + if (is_null($code)) { + throw new InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName(): string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name English name of the language, for display in a picker. + * + * @return $this + */ + public function setName(string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OmrPendingStep.php b/src/Model/OmrPendingStep.php new file mode 100644 index 0000000..6b2f6f5 --- /dev/null +++ b/src/Model/OmrPendingStep.php @@ -0,0 +1,425 @@ + + */ +class OmrPendingStep implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OmrPendingStep'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'step' => '\Flat\APIClient\Model\OmrStepName', + 'data' => '\Flat\APIClient\Model\OmrDetailsStepData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'step' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'step' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'step' => 'step', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'step' => 'setStep', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'step' => 'getStep', + 'data' => 'getData' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('step', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['step'] === null) { + $invalidProperties[] = "'step' can't be null"; + } + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets step + * + * @return \Flat\APIClient\Model\OmrStepName + */ + public function getStep(): \Flat\APIClient\Model\OmrStepName + { + return $this->container['step']; + } + + /** + * Sets step + * + * @param \Flat\APIClient\Model\OmrStepName $step step + * + * @return $this + */ + public function setStep(\Flat\APIClient\Model\OmrStepName $step): static + { + if (is_null($step)) { + throw new InvalidArgumentException('non-nullable step cannot be null'); + } + $this->container['step'] = $step; + + return $this; + } + + /** + * Gets data + * + * @return \Flat\APIClient\Model\OmrDetailsStepData + */ + public function getData(): \Flat\APIClient\Model\OmrDetailsStepData + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Flat\APIClient\Model\OmrDetailsStepData $data data + * + * @return $this + */ + public function setData(\Flat\APIClient\Model\OmrDetailsStepData $data): static + { + if (is_null($data)) { + throw new InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OmrStepName.php b/src/Model/OmrStepName.php new file mode 100644 index 0000000..733af1f --- /dev/null +++ b/src/Model/OmrStepName.php @@ -0,0 +1,44 @@ + + */ + public static function getOneOfDiscriminatorMappings(): array; +} diff --git a/src/Model/OrganizationInvitation.php b/src/Model/OrganizationInvitation.php new file mode 100644 index 0000000..50ff01c --- /dev/null +++ b/src/Model/OrganizationInvitation.php @@ -0,0 +1,710 @@ + + */ +class OrganizationInvitation implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OrganizationInvitation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'creation_date' => '\DateTime', + 'organization' => 'string', + 'organization_role' => '\Flat\APIClient\Model\OrganizationRoles', + 'custom_code' => 'string', + 'email' => 'string', + 'invited_by' => 'string', + 'html_url' => 'string', + 'allow_multiple_use' => 'bool', + 'used_by' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'creation_date' => 'date-time', + 'organization' => null, + 'organization_role' => null, + 'custom_code' => null, + 'email' => null, + 'invited_by' => null, + 'html_url' => null, + 'allow_multiple_use' => null, + 'used_by' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'creation_date' => false, + 'organization' => false, + 'organization_role' => false, + 'custom_code' => true, + 'email' => false, + 'invited_by' => false, + 'html_url' => false, + 'allow_multiple_use' => false, + 'used_by' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'creation_date' => 'creationDate', + 'organization' => 'organization', + 'organization_role' => 'organizationRole', + 'custom_code' => 'customCode', + 'email' => 'email', + 'invited_by' => 'invitedBy', + 'html_url' => 'htmlUrl', + 'allow_multiple_use' => 'allowMultipleUse', + 'used_by' => 'usedBy' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'creation_date' => 'setCreationDate', + 'organization' => 'setOrganization', + 'organization_role' => 'setOrganizationRole', + 'custom_code' => 'setCustomCode', + 'email' => 'setEmail', + 'invited_by' => 'setInvitedBy', + 'html_url' => 'setHtmlUrl', + 'allow_multiple_use' => 'setAllowMultipleUse', + 'used_by' => 'setUsedBy' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'creation_date' => 'getCreationDate', + 'organization' => 'getOrganization', + 'organization_role' => 'getOrganizationRole', + 'custom_code' => 'getCustomCode', + 'email' => 'getEmail', + 'invited_by' => 'getInvitedBy', + 'html_url' => 'getHtmlUrl', + 'allow_multiple_use' => 'getAllowMultipleUse', + 'used_by' => 'getUsedBy' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('creation_date', $data ?? [], null); + $this->setIfExists('organization', $data ?? [], null); + $this->setIfExists('organization_role', $data ?? [], null); + $this->setIfExists('custom_code', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('invited_by', $data ?? [], null); + $this->setIfExists('html_url', $data ?? [], null); + $this->setIfExists('allow_multiple_use', $data ?? [], null); + $this->setIfExists('used_by', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['organization'] === null) { + $invalidProperties[] = "'organization' can't be null"; + } + if ($this->container['organization_role'] === null) { + $invalidProperties[] = "'organization_role' can't be null"; + } + if ($this->container['custom_code'] === null && !$this->isNullableSetToNull('custom_code')) { + $invalidProperties[] = "'custom_code' is required"; + } + if ($this->container['allow_multiple_use'] === null) { + $invalidProperties[] = "'allow_multiple_use' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The invitation unique identifier + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets creation_date + * + * @return \DateTime|null + */ + public function getCreationDate(): ?\DateTime + { + return $this->container['creation_date']; + } + + /** + * Sets creation_date + * + * @param \DateTime|null $creation_date The creation date of the invitation + * + * @return $this + */ + public function setCreationDate(?\DateTime $creation_date): static + { + if (is_null($creation_date)) { + throw new InvalidArgumentException('non-nullable creation_date cannot be null'); + } + $this->container['creation_date'] = $creation_date; + + return $this; + } + + /** + * Gets organization + * + * @return string + */ + public function getOrganization(): string + { + return $this->container['organization']; + } + + /** + * Sets organization + * + * @param string $organization The unique identifier of the Organization owning this class + * + * @return $this + */ + public function setOrganization(string $organization): static + { + if (is_null($organization)) { + throw new InvalidArgumentException('non-nullable organization cannot be null'); + } + $this->container['organization'] = $organization; + + return $this; + } + + /** + * Gets organization_role + * + * @return \Flat\APIClient\Model\OrganizationRoles + */ + public function getOrganizationRole(): \Flat\APIClient\Model\OrganizationRoles + { + return $this->container['organization_role']; + } + + /** + * Sets organization_role + * + * @param \Flat\APIClient\Model\OrganizationRoles $organization_role organization_role + * + * @return $this + */ + public function setOrganizationRole(\Flat\APIClient\Model\OrganizationRoles $organization_role): static + { + if (is_null($organization_role)) { + throw new InvalidArgumentException('non-nullable organization_role cannot be null'); + } + $this->container['organization_role'] = $organization_role; + + return $this; + } + + /** + * Gets custom_code + * + * @return string|null + */ + public function getCustomCode(): ?string + { + return $this->container['custom_code']; + } + + /** + * Sets custom_code + * + * @param string|null $custom_code Enrollment code to use when joining this organization + * + * @return $this + */ + public function setCustomCode(?string $custom_code): static + { + if (is_null($custom_code)) { + array_push($this->openAPINullablesSetToNull, 'custom_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['custom_code'] = $custom_code; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail(): ?string + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email The email address this invitation was sent to + * + * @return $this + */ + public function setEmail(?string $email): static + { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets invited_by + * + * @return string|null + */ + public function getInvitedBy(): ?string + { + return $this->container['invited_by']; + } + + /** + * Sets invited_by + * + * @param string|null $invited_by The unique identifier of the User who created this invitation + * + * @return $this + */ + public function setInvitedBy(?string $invited_by): static + { + if (is_null($invited_by)) { + throw new InvalidArgumentException('non-nullable invited_by cannot be null'); + } + $this->container['invited_by'] = $invited_by; + + return $this; + } + + /** + * Gets html_url + * + * @return string|null + */ + public function getHtmlUrl(): ?string + { + return $this->container['html_url']; + } + + /** + * Sets html_url + * + * @param string|null $html_url URL to join the organization using this invitation + * + * @return $this + */ + public function setHtmlUrl(?string $html_url): static + { + if (is_null($html_url)) { + throw new InvalidArgumentException('non-nullable html_url cannot be null'); + } + $this->container['html_url'] = $html_url; + + return $this; + } + + /** + * Gets allow_multiple_use + * + * @return bool + */ + public function getAllowMultipleUse(): bool + { + return $this->container['allow_multiple_use']; + } + + /** + * Sets allow_multiple_use + * + * @param bool $allow_multiple_use If true, the invitation can be used multiple times. If false, the invitation can only be used once. + * + * @return $this + */ + public function setAllowMultipleUse(bool $allow_multiple_use): static + { + if (is_null($allow_multiple_use)) { + throw new InvalidArgumentException('non-nullable allow_multiple_use cannot be null'); + } + $this->container['allow_multiple_use'] = $allow_multiple_use; + + return $this; + } + + /** + * Gets used_by + * + * @return string[]|null + */ + public function getUsedBy(): ?array + { + return $this->container['used_by']; + } + + /** + * Sets used_by + * + * @param string[]|null $used_by List of users who used this invitation + * + * @return $this + */ + public function setUsedBy(?array $used_by): static + { + if (is_null($used_by)) { + throw new InvalidArgumentException('non-nullable used_by cannot be null'); + } + $this->container['used_by'] = $used_by; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OrganizationInvitationCreation.php b/src/Model/OrganizationInvitationCreation.php new file mode 100644 index 0000000..5d2c1af --- /dev/null +++ b/src/Model/OrganizationInvitationCreation.php @@ -0,0 +1,455 @@ + + */ +class OrganizationInvitationCreation implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OrganizationInvitationCreation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'email' => 'string', + 'organization_role' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'email' => null, + 'organization_role' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'email' => false, + 'organization_role' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'email' => 'email', + 'organization_role' => 'organizationRole' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'email' => 'setEmail', + 'organization_role' => 'setOrganizationRole' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'email' => 'getEmail', + 'organization_role' => 'getOrganizationRole' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const ORGANIZATION_ROLE_ADMIN = 'admin'; + public const ORGANIZATION_ROLE_TEACHER = 'teacher'; + public const ORGANIZATION_ROLE_ACCOUNT_ADMIN = 'accountAdmin'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getOrganizationRoleAllowableValues() + { + return [ + self::ORGANIZATION_ROLE_ADMIN, + self::ORGANIZATION_ROLE_TEACHER, + self::ORGANIZATION_ROLE_ACCOUNT_ADMIN, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('organization_role', $data ?? [], 'teacher'); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = self::getOrganizationRoleAllowableValues(); + if (!is_null($this->container['organization_role']) && !in_array($this->container['organization_role'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'organization_role', must be one of '%s'", + $this->container['organization_role'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets email + * + * @return string|null + */ + public function getEmail(): ?string + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email The email address you want to send the invitation to + * + * @return $this + */ + public function setEmail(?string $email): static + { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets organization_role + * + * @return string|null + */ + public function getOrganizationRole(): ?string + { + return $this->container['organization_role']; + } + + /** + * Sets organization_role + * + * @param string|null $organization_role User's Organization Role + * + * @return $this + */ + public function setOrganizationRole(?string $organization_role): static + { + if (is_null($organization_role)) { + throw new InvalidArgumentException('non-nullable organization_role cannot be null'); + } + $allowedValues = self::getOrganizationRoleAllowableValues(); + if (!in_array($organization_role, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'organization_role', must be one of '%s'", + $organization_role, + implode("', '", $allowedValues) + ) + ); + } + $this->container['organization_role'] = $organization_role; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OrganizationRoles.php b/src/Model/OrganizationRoles.php new file mode 100644 index 0000000..a6b9879 --- /dev/null +++ b/src/Model/OrganizationRoles.php @@ -0,0 +1,50 @@ + + */ +class OrganizationUserAccessTokenCreation implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OrganizationUserAccessTokenCreation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'scopes' => '\Flat\APIClient\Model\AppScopes[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'scopes' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'scopes' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'scopes' => 'scopes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'scopes' => 'setScopes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'scopes' => 'getScopes' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('scopes', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['scopes'] === null) { + $invalidProperties[] = "'scopes' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets scopes + * + * @return \Flat\APIClient\Model\AppScopes[] + */ + public function getScopes(): array + { + return $this->container['scopes']; + } + + /** + * Sets scopes + * + * @param \Flat\APIClient\Model\AppScopes[] $scopes List of requested scopes for this credential + * + * @return $this + */ + public function setScopes(array $scopes): static + { + if (is_null($scopes)) { + throw new InvalidArgumentException('non-nullable scopes cannot be null'); + } + $this->container['scopes'] = $scopes; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/RenameGroupRequest.php b/src/Model/RenameGroupRequest.php new file mode 100644 index 0000000..a5db8de --- /dev/null +++ b/src/Model/RenameGroupRequest.php @@ -0,0 +1,387 @@ + + */ +class RenameGroupRequest implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'renameGroup_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName(): string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name New name for the group + * + * @return $this + */ + public function setName(string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ResourceCollaborator.php b/src/Model/ResourceCollaborator.php new file mode 100644 index 0000000..918aa63 --- /dev/null +++ b/src/Model/ResourceCollaborator.php @@ -0,0 +1,838 @@ + + */ +class ResourceCollaborator implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ResourceCollaborator'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'acl_read' => 'bool', + 'acl_write' => 'bool', + 'acl_admin' => 'bool', + 'is_collaborator' => 'bool', + 'collaborator_type' => 'string', + 'id' => 'string', + 'date' => '\DateTime', + 'score' => 'string', + 'collection' => 'string', + 'user' => '\Flat\APIClient\Model\UserPublic', + 'group' => '\Flat\APIClient\Model\Group', + 'user_email' => 'string', + 'invited' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'acl_read' => null, + 'acl_write' => null, + 'acl_admin' => null, + 'is_collaborator' => null, + 'collaborator_type' => null, + 'id' => null, + 'date' => 'date-time', + 'score' => null, + 'collection' => null, + 'user' => null, + 'group' => null, + 'user_email' => null, + 'invited' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'acl_read' => false, + 'acl_write' => false, + 'acl_admin' => false, + 'is_collaborator' => false, + 'collaborator_type' => false, + 'id' => false, + 'date' => false, + 'score' => false, + 'collection' => false, + 'user' => false, + 'group' => false, + 'user_email' => false, + 'invited' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'acl_read' => 'aclRead', + 'acl_write' => 'aclWrite', + 'acl_admin' => 'aclAdmin', + 'is_collaborator' => 'isCollaborator', + 'collaborator_type' => 'collaboratorType', + 'id' => 'id', + 'date' => 'date', + 'score' => 'score', + 'collection' => 'collection', + 'user' => 'user', + 'group' => 'group', + 'user_email' => 'userEmail', + 'invited' => 'invited' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'acl_read' => 'setAclRead', + 'acl_write' => 'setAclWrite', + 'acl_admin' => 'setAclAdmin', + 'is_collaborator' => 'setIsCollaborator', + 'collaborator_type' => 'setCollaboratorType', + 'id' => 'setId', + 'date' => 'setDate', + 'score' => 'setScore', + 'collection' => 'setCollection', + 'user' => 'setUser', + 'group' => 'setGroup', + 'user_email' => 'setUserEmail', + 'invited' => 'setInvited' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'acl_read' => 'getAclRead', + 'acl_write' => 'getAclWrite', + 'acl_admin' => 'getAclAdmin', + 'is_collaborator' => 'getIsCollaborator', + 'collaborator_type' => 'getCollaboratorType', + 'id' => 'getId', + 'date' => 'getDate', + 'score' => 'getScore', + 'collection' => 'getCollection', + 'user' => 'getUser', + 'group' => 'getGroup', + 'user_email' => 'getUserEmail', + 'invited' => 'getInvited' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const COLLABORATOR_TYPE_OWNER = 'owner'; + public const COLLABORATOR_TYPE_USER = 'user'; + public const COLLABORATOR_TYPE_GROUP = 'group'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getCollaboratorTypeAllowableValues() + { + return [ + self::COLLABORATOR_TYPE_OWNER, + self::COLLABORATOR_TYPE_USER, + self::COLLABORATOR_TYPE_GROUP, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('acl_read', $data ?? [], false); + $this->setIfExists('acl_write', $data ?? [], false); + $this->setIfExists('acl_admin', $data ?? [], false); + $this->setIfExists('is_collaborator', $data ?? [], false); + $this->setIfExists('collaborator_type', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('score', $data ?? [], null); + $this->setIfExists('collection', $data ?? [], null); + $this->setIfExists('user', $data ?? [], null); + $this->setIfExists('group', $data ?? [], null); + $this->setIfExists('user_email', $data ?? [], null); + $this->setIfExists('invited', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['acl_read'] === null) { + $invalidProperties[] = "'acl_read' can't be null"; + } + if ($this->container['acl_write'] === null) { + $invalidProperties[] = "'acl_write' can't be null"; + } + if ($this->container['acl_admin'] === null) { + $invalidProperties[] = "'acl_admin' can't be null"; + } + $allowedValues = self::getCollaboratorTypeAllowableValues(); + if (!is_null($this->container['collaborator_type']) && !in_array($this->container['collaborator_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'collaborator_type', must be one of '%s'", + $this->container['collaborator_type'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets acl_read + * + * @return bool + */ + public function getAclRead(): bool + { + return $this->container['acl_read']; + } + + /** + * Sets acl_read + * + * @param bool $acl_read `True` if the current user can read the current document + * + * @return $this + */ + public function setAclRead(bool $acl_read): static + { + if (is_null($acl_read)) { + throw new InvalidArgumentException('non-nullable acl_read cannot be null'); + } + $this->container['acl_read'] = $acl_read; + + return $this; + } + + /** + * Gets acl_write + * + * @return bool + */ + public function getAclWrite(): bool + { + return $this->container['acl_write']; + } + + /** + * Sets acl_write + * + * @param bool $acl_write `True` if the current user can modify the current document. If this is a right of a Collection, the capabilities of the associated user can be lower than this permission, check out the `capabilities` property as the end-user to have the complete possibilities with the collection. + * + * @return $this + */ + public function setAclWrite(bool $acl_write): static + { + if (is_null($acl_write)) { + throw new InvalidArgumentException('non-nullable acl_write cannot be null'); + } + $this->container['acl_write'] = $acl_write; + + return $this; + } + + /** + * Gets acl_admin + * + * @return bool + */ + public function getAclAdmin(): bool + { + return $this->container['acl_admin']; + } + + /** + * Sets acl_admin + * + * @param bool $acl_admin `True` if the current user can manage the current document (i.e. share, delete) If this is a right of a Collection, the capabilities of the associated user can be lower than this permission, check out the `capabilities` property as the end-user to have the complete possibilities with the collection. + * + * @return $this + */ + public function setAclAdmin(bool $acl_admin): static + { + if (is_null($acl_admin)) { + throw new InvalidArgumentException('non-nullable acl_admin cannot be null'); + } + $this->container['acl_admin'] = $acl_admin; + + return $this; + } + + /** + * Gets is_collaborator + * + * @return bool|null + */ + public function getIsCollaborator(): ?bool + { + return $this->container['is_collaborator']; + } + + /** + * Sets is_collaborator + * + * @param bool|null $is_collaborator `True` if the current user is a collaborator of the current document (direct or via group). + * + * @return $this + */ + public function setIsCollaborator(?bool $is_collaborator): static + { + if (is_null($is_collaborator)) { + throw new InvalidArgumentException('non-nullable is_collaborator cannot be null'); + } + $this->container['is_collaborator'] = $is_collaborator; + + return $this; + } + + /** + * Gets collaborator_type + * + * @return string|null + */ + public function getCollaboratorType(): ?string + { + return $this->container['collaborator_type']; + } + + /** + * Sets collaborator_type + * + * @param string|null $collaborator_type The type of the collaborator for the resource + * + * @return $this + */ + public function setCollaboratorType(?string $collaborator_type): static + { + if (is_null($collaborator_type)) { + throw new InvalidArgumentException('non-nullable collaborator_type cannot be null'); + } + $allowedValues = self::getCollaboratorTypeAllowableValues(); + if (!in_array($collaborator_type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'collaborator_type', must be one of '%s'", + $collaborator_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['collaborator_type'] = $collaborator_type; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The unique identifier of the permission + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate(): ?\DateTime + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date The date when the permission was added + * + * @return $this + */ + public function setDate(?\DateTime $date): static + { + if (is_null($date)) { + throw new InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets score + * + * @return string|null + */ + public function getScore(): ?string + { + return $this->container['score']; + } + + /** + * Sets score + * + * @param string|null $score If this object is a permission of a score, this property will contain the unique identifier of the score + * + * @return $this + */ + public function setScore(?string $score): static + { + if (is_null($score)) { + throw new InvalidArgumentException('non-nullable score cannot be null'); + } + $this->container['score'] = $score; + + return $this; + } + + /** + * Gets collection + * + * @return string|null + */ + public function getCollection(): ?string + { + return $this->container['collection']; + } + + /** + * Sets collection + * + * @param string|null $collection If this object is a permission of a collection, this property will contain the unique identifier of the collection + * + * @return $this + */ + public function setCollection(?string $collection): static + { + if (is_null($collection)) { + throw new InvalidArgumentException('non-nullable collection cannot be null'); + } + $this->container['collection'] = $collection; + + return $this; + } + + /** + * Gets user + * + * @return \Flat\APIClient\Model\UserPublic|null + */ + public function getUser(): ?\Flat\APIClient\Model\UserPublic + { + return $this->container['user']; + } + + /** + * Sets user + * + * @param \Flat\APIClient\Model\UserPublic|null $user user + * + * @return $this + */ + public function setUser(?\Flat\APIClient\Model\UserPublic $user): static + { + if (is_null($user)) { + throw new InvalidArgumentException('non-nullable user cannot be null'); + } + $this->container['user'] = $user; + + return $this; + } + + /** + * Gets group + * + * @return \Flat\APIClient\Model\Group|null + */ + public function getGroup(): ?\Flat\APIClient\Model\Group + { + return $this->container['group']; + } + + /** + * Sets group + * + * @param \Flat\APIClient\Model\Group|null $group group + * + * @return $this + */ + public function setGroup(?\Flat\APIClient\Model\Group $group): static + { + if (is_null($group)) { + throw new InvalidArgumentException('non-nullable group cannot be null'); + } + $this->container['group'] = $group; + + return $this; + } + + /** + * Gets user_email + * + * @return string|null + */ + public function getUserEmail(): ?string + { + return $this->container['user_email']; + } + + /** + * Sets user_email + * + * @param string|null $user_email If the collaborator is not a user of Flat yet, this field will contain their email. + * + * @return $this + */ + public function setUserEmail(?string $user_email): static + { + if (is_null($user_email)) { + throw new InvalidArgumentException('non-nullable user_email cannot be null'); + } + $this->container['user_email'] = $user_email; + + return $this; + } + + /** + * Gets invited + * + * @return bool|null + */ + public function getInvited(): ?bool + { + return $this->container['invited']; + } + + /** + * Sets invited + * + * @param bool|null $invited If this property is `true`, this is still a pending invitation + * + * @return $this + */ + public function setInvited(?bool $invited): static + { + if (is_null($invited)) { + throw new InvalidArgumentException('non-nullable invited cannot be null'); + } + $this->container['invited'] = $invited; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ResourceCollaboratorCreation.php b/src/Model/ResourceCollaboratorCreation.php new file mode 100644 index 0000000..55d77b5 --- /dev/null +++ b/src/Model/ResourceCollaboratorCreation.php @@ -0,0 +1,589 @@ + + */ +class ResourceCollaboratorCreation implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ResourceCollaboratorCreation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'user' => 'string', + 'group' => 'string', + 'user_email' => 'string', + 'user_token' => 'string', + 'acl_read' => 'bool', + 'acl_write' => 'bool', + 'acl_admin' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'user' => null, + 'group' => null, + 'user_email' => null, + 'user_token' => null, + 'acl_read' => null, + 'acl_write' => null, + 'acl_admin' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'user' => false, + 'group' => false, + 'user_email' => false, + 'user_token' => false, + 'acl_read' => false, + 'acl_write' => false, + 'acl_admin' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'user' => 'user', + 'group' => 'group', + 'user_email' => 'userEmail', + 'user_token' => 'userToken', + 'acl_read' => 'aclRead', + 'acl_write' => 'aclWrite', + 'acl_admin' => 'aclAdmin' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'user' => 'setUser', + 'group' => 'setGroup', + 'user_email' => 'setUserEmail', + 'user_token' => 'setUserToken', + 'acl_read' => 'setAclRead', + 'acl_write' => 'setAclWrite', + 'acl_admin' => 'setAclAdmin' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'user' => 'getUser', + 'group' => 'getGroup', + 'user_email' => 'getUserEmail', + 'user_token' => 'getUserToken', + 'acl_read' => 'getAclRead', + 'acl_write' => 'getAclWrite', + 'acl_admin' => 'getAclAdmin' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('user', $data ?? [], null); + $this->setIfExists('group', $data ?? [], null); + $this->setIfExists('user_email', $data ?? [], null); + $this->setIfExists('user_token', $data ?? [], null); + $this->setIfExists('acl_read', $data ?? [], true); + $this->setIfExists('acl_write', $data ?? [], false); + $this->setIfExists('acl_admin', $data ?? [], false); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets user + * + * @return string|null + */ + public function getUser(): ?string + { + return $this->container['user']; + } + + /** + * Sets user + * + * @param string|null $user The unique identifier of a Flat user + * + * @return $this + */ + public function setUser(?string $user): static + { + if (is_null($user)) { + throw new InvalidArgumentException('non-nullable user cannot be null'); + } + $this->container['user'] = $user; + + return $this; + } + + /** + * Gets group + * + * @return string|null + */ + public function getGroup(): ?string + { + return $this->container['group']; + } + + /** + * Sets group + * + * @param string|null $group The unique identifier of a Flat group + * + * @return $this + */ + public function setGroup(?string $group): static + { + if (is_null($group)) { + throw new InvalidArgumentException('non-nullable group cannot be null'); + } + $this->container['group'] = $group; + + return $this; + } + + /** + * Gets user_email + * + * @return string|null + */ + public function getUserEmail(): ?string + { + return $this->container['user_email']; + } + + /** + * Sets user_email + * + * @param string|null $user_email Fill this field to invite an individual user by email. + * + * @return $this + */ + public function setUserEmail(?string $user_email): static + { + if (is_null($user_email)) { + throw new InvalidArgumentException('non-nullable user_email cannot be null'); + } + $this->container['user_email'] = $user_email; + + return $this; + } + + /** + * Gets user_token + * + * @return string|null + */ + public function getUserToken(): ?string + { + return $this->container['user_token']; + } + + /** + * Sets user_token + * + * @param string|null $user_token Token received in an invitation to join the score. + * + * @return $this + */ + public function setUserToken(?string $user_token): static + { + if (is_null($user_token)) { + throw new InvalidArgumentException('non-nullable user_token cannot be null'); + } + $this->container['user_token'] = $user_token; + + return $this; + } + + /** + * Gets acl_read + * + * @return bool|null + */ + public function getAclRead(): ?bool + { + return $this->container['acl_read']; + } + + /** + * Sets acl_read + * + * @param bool|null $acl_read `True` if the related user can read the score. (probably true if the user has a permission on the document). + * + * @return $this + */ + public function setAclRead(?bool $acl_read): static + { + if (is_null($acl_read)) { + throw new InvalidArgumentException('non-nullable acl_read cannot be null'); + } + $this->container['acl_read'] = $acl_read; + + return $this; + } + + /** + * Gets acl_write + * + * @return bool|null + */ + public function getAclWrite(): ?bool + { + return $this->container['acl_write']; + } + + /** + * Sets acl_write + * + * @param bool|null $acl_write `True` if the related user can modify the score. + * + * @return $this + */ + public function setAclWrite(?bool $acl_write): static + { + if (is_null($acl_write)) { + throw new InvalidArgumentException('non-nullable acl_write cannot be null'); + } + $this->container['acl_write'] = $acl_write; + + return $this; + } + + /** + * Gets acl_admin + * + * @return bool|null + */ + public function getAclAdmin(): ?bool + { + return $this->container['acl_admin']; + } + + /** + * Sets acl_admin + * + * @param bool|null $acl_admin `True` if the related user can can manage the current document, i.e. changing the document permissions and deleting the document + * + * @return $this + */ + public function setAclAdmin(?bool $acl_admin): static + { + if (is_null($acl_admin)) { + throw new InvalidArgumentException('non-nullable acl_admin cannot be null'); + } + $this->container['acl_admin'] = $acl_admin; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ResourceRights.php b/src/Model/ResourceRights.php new file mode 100644 index 0000000..c29a3af --- /dev/null +++ b/src/Model/ResourceRights.php @@ -0,0 +1,566 @@ + + */ +class ResourceRights implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ResourceRights'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'acl_read' => 'bool', + 'acl_write' => 'bool', + 'acl_admin' => 'bool', + 'is_collaborator' => 'bool', + 'collaborator_type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'acl_read' => null, + 'acl_write' => null, + 'acl_admin' => null, + 'is_collaborator' => null, + 'collaborator_type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'acl_read' => false, + 'acl_write' => false, + 'acl_admin' => false, + 'is_collaborator' => false, + 'collaborator_type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'acl_read' => 'aclRead', + 'acl_write' => 'aclWrite', + 'acl_admin' => 'aclAdmin', + 'is_collaborator' => 'isCollaborator', + 'collaborator_type' => 'collaboratorType' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'acl_read' => 'setAclRead', + 'acl_write' => 'setAclWrite', + 'acl_admin' => 'setAclAdmin', + 'is_collaborator' => 'setIsCollaborator', + 'collaborator_type' => 'setCollaboratorType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'acl_read' => 'getAclRead', + 'acl_write' => 'getAclWrite', + 'acl_admin' => 'getAclAdmin', + 'is_collaborator' => 'getIsCollaborator', + 'collaborator_type' => 'getCollaboratorType' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const COLLABORATOR_TYPE_OWNER = 'owner'; + public const COLLABORATOR_TYPE_USER = 'user'; + public const COLLABORATOR_TYPE_GROUP = 'group'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getCollaboratorTypeAllowableValues() + { + return [ + self::COLLABORATOR_TYPE_OWNER, + self::COLLABORATOR_TYPE_USER, + self::COLLABORATOR_TYPE_GROUP, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('acl_read', $data ?? [], false); + $this->setIfExists('acl_write', $data ?? [], false); + $this->setIfExists('acl_admin', $data ?? [], false); + $this->setIfExists('is_collaborator', $data ?? [], false); + $this->setIfExists('collaborator_type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['acl_read'] === null) { + $invalidProperties[] = "'acl_read' can't be null"; + } + if ($this->container['acl_write'] === null) { + $invalidProperties[] = "'acl_write' can't be null"; + } + if ($this->container['acl_admin'] === null) { + $invalidProperties[] = "'acl_admin' can't be null"; + } + $allowedValues = self::getCollaboratorTypeAllowableValues(); + if (!is_null($this->container['collaborator_type']) && !in_array($this->container['collaborator_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'collaborator_type', must be one of '%s'", + $this->container['collaborator_type'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets acl_read + * + * @return bool + */ + public function getAclRead(): bool + { + return $this->container['acl_read']; + } + + /** + * Sets acl_read + * + * @param bool $acl_read `True` if the current user can read the current document + * + * @return $this + */ + public function setAclRead(bool $acl_read): static + { + if (is_null($acl_read)) { + throw new InvalidArgumentException('non-nullable acl_read cannot be null'); + } + $this->container['acl_read'] = $acl_read; + + return $this; + } + + /** + * Gets acl_write + * + * @return bool + */ + public function getAclWrite(): bool + { + return $this->container['acl_write']; + } + + /** + * Sets acl_write + * + * @param bool $acl_write `True` if the current user can modify the current document. If this is a right of a Collection, the capabilities of the associated user can be lower than this permission, check out the `capabilities` property as the end-user to have the complete possibilities with the collection. + * + * @return $this + */ + public function setAclWrite(bool $acl_write): static + { + if (is_null($acl_write)) { + throw new InvalidArgumentException('non-nullable acl_write cannot be null'); + } + $this->container['acl_write'] = $acl_write; + + return $this; + } + + /** + * Gets acl_admin + * + * @return bool + */ + public function getAclAdmin(): bool + { + return $this->container['acl_admin']; + } + + /** + * Sets acl_admin + * + * @param bool $acl_admin `True` if the current user can manage the current document (i.e. share, delete) If this is a right of a Collection, the capabilities of the associated user can be lower than this permission, check out the `capabilities` property as the end-user to have the complete possibilities with the collection. + * + * @return $this + */ + public function setAclAdmin(bool $acl_admin): static + { + if (is_null($acl_admin)) { + throw new InvalidArgumentException('non-nullable acl_admin cannot be null'); + } + $this->container['acl_admin'] = $acl_admin; + + return $this; + } + + /** + * Gets is_collaborator + * + * @return bool|null + */ + public function getIsCollaborator(): ?bool + { + return $this->container['is_collaborator']; + } + + /** + * Sets is_collaborator + * + * @param bool|null $is_collaborator `True` if the current user is a collaborator of the current document (direct or via group). + * + * @return $this + */ + public function setIsCollaborator(?bool $is_collaborator): static + { + if (is_null($is_collaborator)) { + throw new InvalidArgumentException('non-nullable is_collaborator cannot be null'); + } + $this->container['is_collaborator'] = $is_collaborator; + + return $this; + } + + /** + * Gets collaborator_type + * + * @return string|null + */ + public function getCollaboratorType(): ?string + { + return $this->container['collaborator_type']; + } + + /** + * Sets collaborator_type + * + * @param string|null $collaborator_type The type of the collaborator for the resource + * + * @return $this + */ + public function setCollaboratorType(?string $collaborator_type): static + { + if (is_null($collaborator_type)) { + throw new InvalidArgumentException('non-nullable collaborator_type cannot be null'); + } + $allowedValues = self::getCollaboratorTypeAllowableValues(); + if (!in_array($collaborator_type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'collaborator_type', must be one of '%s'", + $collaborator_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['collaborator_type'] = $collaborator_type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreComment.php b/src/Model/ScoreComment.php new file mode 100644 index 0000000..fe59a17 --- /dev/null +++ b/src/Model/ScoreComment.php @@ -0,0 +1,950 @@ + + */ +class ScoreComment implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreComment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'type' => 'string', + 'user' => 'string', + 'score' => 'string', + 'revision' => 'string', + 'reply_to' => 'string', + 'date' => '\DateTime', + 'modification_date' => '\DateTime', + 'comment' => 'string', + 'raw_comment' => 'string', + 'context' => '\Flat\APIClient\Model\ScoreCommentContext', + 'mentions' => 'string[]', + 'resolved' => 'bool', + 'resolved_by' => 'string', + 'moderation' => '\Flat\APIClient\Model\ScoreCommentModeration', + 'spam' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'type' => null, + 'user' => null, + 'score' => null, + 'revision' => null, + 'reply_to' => null, + 'date' => 'date-time', + 'modification_date' => 'date-time', + 'comment' => null, + 'raw_comment' => null, + 'context' => null, + 'mentions' => null, + 'resolved' => null, + 'resolved_by' => null, + 'moderation' => null, + 'spam' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'type' => false, + 'user' => false, + 'score' => false, + 'revision' => false, + 'reply_to' => false, + 'date' => false, + 'modification_date' => false, + 'comment' => false, + 'raw_comment' => false, + 'context' => false, + 'mentions' => false, + 'resolved' => false, + 'resolved_by' => false, + 'moderation' => false, + 'spam' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'type' => 'type', + 'user' => 'user', + 'score' => 'score', + 'revision' => 'revision', + 'reply_to' => 'replyTo', + 'date' => 'date', + 'modification_date' => 'modificationDate', + 'comment' => 'comment', + 'raw_comment' => 'rawComment', + 'context' => 'context', + 'mentions' => 'mentions', + 'resolved' => 'resolved', + 'resolved_by' => 'resolvedBy', + 'moderation' => 'moderation', + 'spam' => 'spam' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'type' => 'setType', + 'user' => 'setUser', + 'score' => 'setScore', + 'revision' => 'setRevision', + 'reply_to' => 'setReplyTo', + 'date' => 'setDate', + 'modification_date' => 'setModificationDate', + 'comment' => 'setComment', + 'raw_comment' => 'setRawComment', + 'context' => 'setContext', + 'mentions' => 'setMentions', + 'resolved' => 'setResolved', + 'resolved_by' => 'setResolvedBy', + 'moderation' => 'setModeration', + 'spam' => 'setSpam' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'type' => 'getType', + 'user' => 'getUser', + 'score' => 'getScore', + 'revision' => 'getRevision', + 'reply_to' => 'getReplyTo', + 'date' => 'getDate', + 'modification_date' => 'getModificationDate', + 'comment' => 'getComment', + 'raw_comment' => 'getRawComment', + 'context' => 'getContext', + 'mentions' => 'getMentions', + 'resolved' => 'getResolved', + 'resolved_by' => 'getResolvedBy', + 'moderation' => 'getModeration', + 'spam' => 'getSpam' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const TYPE_DOCUMENT = 'document'; + public const TYPE_INLINE = 'inline'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getTypeAllowableValues() + { + return [ + self::TYPE_DOCUMENT, + self::TYPE_INLINE, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('user', $data ?? [], null); + $this->setIfExists('score', $data ?? [], null); + $this->setIfExists('revision', $data ?? [], null); + $this->setIfExists('reply_to', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('modification_date', $data ?? [], null); + $this->setIfExists('comment', $data ?? [], null); + $this->setIfExists('raw_comment', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('mentions', $data ?? [], null); + $this->setIfExists('resolved', $data ?? [], null); + $this->setIfExists('resolved_by', $data ?? [], null); + $this->setIfExists('moderation', $data ?? [], null); + $this->setIfExists('spam', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + $allowedValues = self::getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['user'] === null) { + $invalidProperties[] = "'user' can't be null"; + } + if ($this->container['score'] === null) { + $invalidProperties[] = "'score' can't be null"; + } + if ($this->container['date'] === null) { + $invalidProperties[] = "'date' can't be null"; + } + if ($this->container['comment'] === null) { + $invalidProperties[] = "'comment' can't be null"; + } + if ($this->container['raw_comment'] === null) { + $invalidProperties[] = "'raw_comment' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The comment unique identifier + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string + */ + public function getType(): string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type The type of the comment + * + * @return $this + */ + public function setType(string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = self::getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets user + * + * @return string + */ + public function getUser(): string + { + return $this->container['user']; + } + + /** + * Sets user + * + * @param string $user The author unique identifier + * + * @return $this + */ + public function setUser(string $user): static + { + if (is_null($user)) { + throw new InvalidArgumentException('non-nullable user cannot be null'); + } + $this->container['user'] = $user; + + return $this; + } + + /** + * Gets score + * + * @return string + */ + public function getScore(): string + { + return $this->container['score']; + } + + /** + * Sets score + * + * @param string $score The unique identifier of the score where the comment was posted + * + * @return $this + */ + public function setScore(string $score): static + { + if (is_null($score)) { + throw new InvalidArgumentException('non-nullable score cannot be null'); + } + $this->container['score'] = $score; + + return $this; + } + + /** + * Gets revision + * + * @return string|null + */ + public function getRevision(): ?string + { + return $this->container['revision']; + } + + /** + * Sets revision + * + * @param string|null $revision The unique identifier of revision the comment was posted + * + * @return $this + */ + public function setRevision(?string $revision): static + { + if (is_null($revision)) { + throw new InvalidArgumentException('non-nullable revision cannot be null'); + } + $this->container['revision'] = $revision; + + return $this; + } + + /** + * Gets reply_to + * + * @return string|null + */ + public function getReplyTo(): ?string + { + return $this->container['reply_to']; + } + + /** + * Sets reply_to + * + * @param string|null $reply_to When the comment is a reply to another comment, the unique identifier of the parent comment + * + * @return $this + */ + public function setReplyTo(?string $reply_to): static + { + if (is_null($reply_to)) { + throw new InvalidArgumentException('non-nullable reply_to cannot be null'); + } + $this->container['reply_to'] = $reply_to; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime + */ + public function getDate(): \DateTime + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime $date The date when the comment was posted + * + * @return $this + */ + public function setDate(\DateTime $date): static + { + if (is_null($date)) { + throw new InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets modification_date + * + * @return \DateTime|null + */ + public function getModificationDate(): ?\DateTime + { + return $this->container['modification_date']; + } + + /** + * Sets modification_date + * + * @param \DateTime|null $modification_date The date of the last comment modification + * + * @return $this + */ + public function setModificationDate(?\DateTime $modification_date): static + { + if (is_null($modification_date)) { + throw new InvalidArgumentException('non-nullable modification_date cannot be null'); + } + $this->container['modification_date'] = $modification_date; + + return $this; + } + + /** + * Gets comment + * + * @return string + */ + public function getComment(): string + { + return $this->container['comment']; + } + + /** + * Sets comment + * + * @param string $comment The comment text that can includes mentions using the following format: `@[id:username]`. + * + * @return $this + */ + public function setComment(string $comment): static + { + if (is_null($comment)) { + throw new InvalidArgumentException('non-nullable comment cannot be null'); + } + $this->container['comment'] = $comment; + + return $this; + } + + /** + * Gets raw_comment + * + * @return string + */ + public function getRawComment(): string + { + return $this->container['raw_comment']; + } + + /** + * Sets raw_comment + * + * @param string $raw_comment A raw version of the comment, that can be displayed without parsing the mentions. + * + * @return $this + */ + public function setRawComment(string $raw_comment): static + { + if (is_null($raw_comment)) { + throw new InvalidArgumentException('non-nullable raw_comment cannot be null'); + } + $this->container['raw_comment'] = $raw_comment; + + return $this; + } + + /** + * Gets context + * + * @return \Flat\APIClient\Model\ScoreCommentContext|null + */ + public function getContext(): ?\Flat\APIClient\Model\ScoreCommentContext + { + return $this->container['context']; + } + + /** + * Sets context + * + * @param \Flat\APIClient\Model\ScoreCommentContext|null $context context + * + * @return $this + */ + public function setContext(?\Flat\APIClient\Model\ScoreCommentContext $context): static + { + if (is_null($context)) { + throw new InvalidArgumentException('non-nullable context cannot be null'); + } + $this->container['context'] = $context; + + return $this; + } + + /** + * Gets mentions + * + * @return string[]|null + */ + public function getMentions(): ?array + { + return $this->container['mentions']; + } + + /** + * Sets mentions + * + * @param string[]|null $mentions The list of user identifier mentioned on the score + * + * @return $this + */ + public function setMentions(?array $mentions): static + { + if (is_null($mentions)) { + throw new InvalidArgumentException('non-nullable mentions cannot be null'); + } + $this->container['mentions'] = $mentions; + + return $this; + } + + /** + * Gets resolved + * + * @return bool|null + */ + public function getResolved(): ?bool + { + return $this->container['resolved']; + } + + /** + * Sets resolved + * + * @param bool|null $resolved For inline comments, the comment can be marked as resolved and will be hidden in the future responses + * + * @return $this + */ + public function setResolved(?bool $resolved): static + { + if (is_null($resolved)) { + throw new InvalidArgumentException('non-nullable resolved cannot be null'); + } + $this->container['resolved'] = $resolved; + + return $this; + } + + /** + * Gets resolved_by + * + * @return string|null + */ + public function getResolvedBy(): ?string + { + return $this->container['resolved_by']; + } + + /** + * Sets resolved_by + * + * @param string|null $resolved_by If the user is marked as resolved, this will contain the unique identifier of the User who marked this comment as resolved + * + * @return $this + */ + public function setResolvedBy(?string $resolved_by): static + { + if (is_null($resolved_by)) { + throw new InvalidArgumentException('non-nullable resolved_by cannot be null'); + } + $this->container['resolved_by'] = $resolved_by; + + return $this; + } + + /** + * Gets moderation + * + * @return \Flat\APIClient\Model\ScoreCommentModeration|null + */ + public function getModeration(): ?\Flat\APIClient\Model\ScoreCommentModeration + { + return $this->container['moderation']; + } + + /** + * Sets moderation + * + * @param \Flat\APIClient\Model\ScoreCommentModeration|null $moderation moderation + * + * @return $this + */ + public function setModeration(?\Flat\APIClient\Model\ScoreCommentModeration $moderation): static + { + if (is_null($moderation)) { + throw new InvalidArgumentException('non-nullable moderation cannot be null'); + } + $this->container['moderation'] = $moderation; + + return $this; + } + + /** + * Gets spam + * + * @return bool|null + */ + public function getSpam(): ?bool + { + return $this->container['spam']; + } + + /** + * Sets spam + * + * @param bool|null $spam `true if the message has been detected as spam and hidden from other users + * + * @return $this + */ + public function setSpam(?bool $spam): static + { + if (is_null($spam)) { + throw new InvalidArgumentException('non-nullable spam cannot be null'); + } + $this->container['spam'] = $spam; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreCommentContext.php b/src/Model/ScoreCommentContext.php new file mode 100644 index 0000000..f740c34 --- /dev/null +++ b/src/Model/ScoreCommentContext.php @@ -0,0 +1,643 @@ + + */ +class ScoreCommentContext implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreCommentContext'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'part_uuid' => 'string', + 'staff_idx' => 'float', + 'staff_uuid' => 'string', + 'measure_uuids' => 'string[]', + 'start_time_pos' => 'float', + 'stop_time_pos' => 'float', + 'start_dpq' => 'float', + 'stop_dpq' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'part_uuid' => null, + 'staff_idx' => null, + 'staff_uuid' => null, + 'measure_uuids' => null, + 'start_time_pos' => null, + 'stop_time_pos' => null, + 'start_dpq' => null, + 'stop_dpq' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'part_uuid' => false, + 'staff_idx' => false, + 'staff_uuid' => false, + 'measure_uuids' => false, + 'start_time_pos' => false, + 'stop_time_pos' => false, + 'start_dpq' => false, + 'stop_dpq' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'part_uuid' => 'partUuid', + 'staff_idx' => 'staffIdx', + 'staff_uuid' => 'staffUuid', + 'measure_uuids' => 'measureUuids', + 'start_time_pos' => 'startTimePos', + 'stop_time_pos' => 'stopTimePos', + 'start_dpq' => 'startDpq', + 'stop_dpq' => 'stopDpq' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'part_uuid' => 'setPartUuid', + 'staff_idx' => 'setStaffIdx', + 'staff_uuid' => 'setStaffUuid', + 'measure_uuids' => 'setMeasureUuids', + 'start_time_pos' => 'setStartTimePos', + 'stop_time_pos' => 'setStopTimePos', + 'start_dpq' => 'setStartDpq', + 'stop_dpq' => 'setStopDpq' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'part_uuid' => 'getPartUuid', + 'staff_idx' => 'getStaffIdx', + 'staff_uuid' => 'getStaffUuid', + 'measure_uuids' => 'getMeasureUuids', + 'start_time_pos' => 'getStartTimePos', + 'stop_time_pos' => 'getStopTimePos', + 'start_dpq' => 'getStartDpq', + 'stop_dpq' => 'getStopDpq' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('part_uuid', $data ?? [], null); + $this->setIfExists('staff_idx', $data ?? [], null); + $this->setIfExists('staff_uuid', $data ?? [], null); + $this->setIfExists('measure_uuids', $data ?? [], null); + $this->setIfExists('start_time_pos', $data ?? [], null); + $this->setIfExists('stop_time_pos', $data ?? [], null); + $this->setIfExists('start_dpq', $data ?? [], null); + $this->setIfExists('stop_dpq', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['part_uuid'] === null) { + $invalidProperties[] = "'part_uuid' can't be null"; + } + if ($this->container['measure_uuids'] === null) { + $invalidProperties[] = "'measure_uuids' can't be null"; + } + if ($this->container['start_time_pos'] === null) { + $invalidProperties[] = "'start_time_pos' can't be null"; + } + if ($this->container['stop_time_pos'] === null) { + $invalidProperties[] = "'stop_time_pos' can't be null"; + } + if ($this->container['start_dpq'] === null) { + $invalidProperties[] = "'start_dpq' can't be null"; + } + if ($this->container['stop_dpq'] === null) { + $invalidProperties[] = "'stop_dpq' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets part_uuid + * + * @return string + */ + public function getPartUuid(): string + { + return $this->container['part_uuid']; + } + + /** + * Sets part_uuid + * + * @param string $part_uuid The unique identifier (UUID) of the score part + * + * @return $this + */ + public function setPartUuid(string $part_uuid): static + { + if (is_null($part_uuid)) { + throw new InvalidArgumentException('non-nullable part_uuid cannot be null'); + } + $this->container['part_uuid'] = $part_uuid; + + return $this; + } + + /** + * Gets staff_idx + * + * @return float|null + * @deprecated + */ + public function getStaffIdx(): ?float + { + return $this->container['staff_idx']; + } + + /** + * Sets staff_idx + * + * @param float|null $staff_idx (Deprecated, use `staffUuid`) The identififer of the staff + * + * @return $this + * @deprecated + */ + public function setStaffIdx(?float $staff_idx): static + { + if (is_null($staff_idx)) { + throw new InvalidArgumentException('non-nullable staff_idx cannot be null'); + } + $this->container['staff_idx'] = $staff_idx; + + return $this; + } + + /** + * Gets staff_uuid + * + * @return string|null + */ + public function getStaffUuid(): ?string + { + return $this->container['staff_uuid']; + } + + /** + * Sets staff_uuid + * + * @param string|null $staff_uuid The unique identififer (UUID) of the staff + * + * @return $this + */ + public function setStaffUuid(?string $staff_uuid): static + { + if (is_null($staff_uuid)) { + throw new InvalidArgumentException('non-nullable staff_uuid cannot be null'); + } + $this->container['staff_uuid'] = $staff_uuid; + + return $this; + } + + /** + * Gets measure_uuids + * + * @return string[] + */ + public function getMeasureUuids(): array + { + return $this->container['measure_uuids']; + } + + /** + * Sets measure_uuids + * + * @param string[] $measure_uuids The list of measure UUIds + * + * @return $this + */ + public function setMeasureUuids(array $measure_uuids): static + { + if (is_null($measure_uuids)) { + throw new InvalidArgumentException('non-nullable measure_uuids cannot be null'); + } + $this->container['measure_uuids'] = $measure_uuids; + + return $this; + } + + /** + * Gets start_time_pos + * + * @return float + */ + public function getStartTimePos(): float + { + return $this->container['start_time_pos']; + } + + /** + * Sets start_time_pos + * + * @param float $start_time_pos start_time_pos + * + * @return $this + */ + public function setStartTimePos(float $start_time_pos): static + { + if (is_null($start_time_pos)) { + throw new InvalidArgumentException('non-nullable start_time_pos cannot be null'); + } + $this->container['start_time_pos'] = $start_time_pos; + + return $this; + } + + /** + * Gets stop_time_pos + * + * @return float + */ + public function getStopTimePos(): float + { + return $this->container['stop_time_pos']; + } + + /** + * Sets stop_time_pos + * + * @param float $stop_time_pos stop_time_pos + * + * @return $this + */ + public function setStopTimePos(float $stop_time_pos): static + { + if (is_null($stop_time_pos)) { + throw new InvalidArgumentException('non-nullable stop_time_pos cannot be null'); + } + $this->container['stop_time_pos'] = $stop_time_pos; + + return $this; + } + + /** + * Gets start_dpq + * + * @return float + */ + public function getStartDpq(): float + { + return $this->container['start_dpq']; + } + + /** + * Sets start_dpq + * + * @param float $start_dpq start_dpq + * + * @return $this + */ + public function setStartDpq(float $start_dpq): static + { + if (is_null($start_dpq)) { + throw new InvalidArgumentException('non-nullable start_dpq cannot be null'); + } + $this->container['start_dpq'] = $start_dpq; + + return $this; + } + + /** + * Gets stop_dpq + * + * @return float + */ + public function getStopDpq(): float + { + return $this->container['stop_dpq']; + } + + /** + * Sets stop_dpq + * + * @param float $stop_dpq stop_dpq + * + * @return $this + */ + public function setStopDpq(float $stop_dpq): static + { + if (is_null($stop_dpq)) { + throw new InvalidArgumentException('non-nullable stop_dpq cannot be null'); + } + $this->container['stop_dpq'] = $stop_dpq; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreCommentCreation.php b/src/Model/ScoreCommentCreation.php new file mode 100644 index 0000000..e34db7c --- /dev/null +++ b/src/Model/ScoreCommentCreation.php @@ -0,0 +1,558 @@ + + */ +class ScoreCommentCreation implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreCommentCreation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'revision' => 'string', + 'comment' => 'string', + 'raw_comment' => 'string', + 'mentions' => 'string[]', + 'reply_to' => 'string', + 'context' => '\Flat\APIClient\Model\ScoreCommentContext' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'revision' => null, + 'comment' => null, + 'raw_comment' => null, + 'mentions' => null, + 'reply_to' => null, + 'context' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'revision' => false, + 'comment' => false, + 'raw_comment' => false, + 'mentions' => false, + 'reply_to' => false, + 'context' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'revision' => 'revision', + 'comment' => 'comment', + 'raw_comment' => 'rawComment', + 'mentions' => 'mentions', + 'reply_to' => 'replyTo', + 'context' => 'context' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'revision' => 'setRevision', + 'comment' => 'setComment', + 'raw_comment' => 'setRawComment', + 'mentions' => 'setMentions', + 'reply_to' => 'setReplyTo', + 'context' => 'setContext' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'revision' => 'getRevision', + 'comment' => 'getComment', + 'raw_comment' => 'getRawComment', + 'mentions' => 'getMentions', + 'reply_to' => 'getReplyTo', + 'context' => 'getContext' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('revision', $data ?? [], null); + $this->setIfExists('comment', $data ?? [], null); + $this->setIfExists('raw_comment', $data ?? [], null); + $this->setIfExists('mentions', $data ?? [], null); + $this->setIfExists('reply_to', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['comment'] === null) { + $invalidProperties[] = "'comment' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets revision + * + * @return string|null + */ + public function getRevision(): ?string + { + return $this->container['revision']; + } + + /** + * Sets revision + * + * @param string|null $revision The unique identifier of the revision of the score where the comment was added. If this property is unspecified or contains \"last\", the API will automatically take the last revision created. + * + * @return $this + */ + public function setRevision(?string $revision): static + { + if (is_null($revision)) { + throw new InvalidArgumentException('non-nullable revision cannot be null'); + } + $this->container['revision'] = $revision; + + return $this; + } + + /** + * Gets comment + * + * @return string + */ + public function getComment(): string + { + return $this->container['comment']; + } + + /** + * Sets comment + * + * @param string $comment The comment text that can includes mentions using the following format: `@[id:username]`. + * + * @return $this + */ + public function setComment(string $comment): static + { + if (is_null($comment)) { + throw new InvalidArgumentException('non-nullable comment cannot be null'); + } + $this->container['comment'] = $comment; + + return $this; + } + + /** + * Gets raw_comment + * + * @return string|null + */ + public function getRawComment(): ?string + { + return $this->container['raw_comment']; + } + + /** + * Sets raw_comment + * + * @param string|null $raw_comment A raw version of the comment, that can be displayed without the mentions. If you use mentions, this property must be set. + * + * @return $this + */ + public function setRawComment(?string $raw_comment): static + { + if (is_null($raw_comment)) { + throw new InvalidArgumentException('non-nullable raw_comment cannot be null'); + } + $this->container['raw_comment'] = $raw_comment; + + return $this; + } + + /** + * Gets mentions + * + * @return string[]|null + */ + public function getMentions(): ?array + { + return $this->container['mentions']; + } + + /** + * Sets mentions + * + * @param string[]|null $mentions The list of user identifiers mentioned in this comment + * + * @return $this + */ + public function setMentions(?array $mentions): static + { + if (is_null($mentions)) { + throw new InvalidArgumentException('non-nullable mentions cannot be null'); + } + $this->container['mentions'] = $mentions; + + return $this; + } + + /** + * Gets reply_to + * + * @return string|null + */ + public function getReplyTo(): ?string + { + return $this->container['reply_to']; + } + + /** + * Sets reply_to + * + * @param string|null $reply_to When the comment is a reply to another comment, the unique identifier of the parent comment + * + * @return $this + */ + public function setReplyTo(?string $reply_to): static + { + if (is_null($reply_to)) { + throw new InvalidArgumentException('non-nullable reply_to cannot be null'); + } + $this->container['reply_to'] = $reply_to; + + return $this; + } + + /** + * Gets context + * + * @return \Flat\APIClient\Model\ScoreCommentContext|null + */ + public function getContext(): ?\Flat\APIClient\Model\ScoreCommentContext + { + return $this->container['context']; + } + + /** + * Sets context + * + * @param \Flat\APIClient\Model\ScoreCommentContext|null $context context + * + * @return $this + */ + public function setContext(?\Flat\APIClient\Model\ScoreCommentContext $context): static + { + if (is_null($context)) { + throw new InvalidArgumentException('non-nullable context cannot be null'); + } + $this->container['context'] = $context; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreCommentModeration.php b/src/Model/ScoreCommentModeration.php new file mode 100644 index 0000000..95c0d3f --- /dev/null +++ b/src/Model/ScoreCommentModeration.php @@ -0,0 +1,453 @@ + + */ +class ScoreCommentModeration implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreComment_moderation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'hidden' => 'bool', + 'reason' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'hidden' => null, + 'reason' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'hidden' => false, + 'reason' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'hidden' => 'hidden', + 'reason' => 'reason' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'hidden' => 'setHidden', + 'reason' => 'setReason' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'hidden' => 'getHidden', + 'reason' => 'getReason' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const REASON_SPAM = 'spam'; + public const REASON_INAPPROPRIATE = 'inappropriate'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getReasonAllowableValues() + { + return [ + self::REASON_SPAM, + self::REASON_INAPPROPRIATE, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('hidden', $data ?? [], null); + $this->setIfExists('reason', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = self::getReasonAllowableValues(); + if (!is_null($this->container['reason']) && !in_array($this->container['reason'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'reason', must be one of '%s'", + $this->container['reason'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets hidden + * + * @return bool|null + */ + public function getHidden(): ?bool + { + return $this->container['hidden']; + } + + /** + * Sets hidden + * + * @param bool|null $hidden If true, this comment will be hidden from other users + * + * @return $this + */ + public function setHidden(?bool $hidden): static + { + if (is_null($hidden)) { + throw new InvalidArgumentException('non-nullable hidden cannot be null'); + } + $this->container['hidden'] = $hidden; + + return $this; + } + + /** + * Gets reason + * + * @return string|null + */ + public function getReason(): ?string + { + return $this->container['reason']; + } + + /** + * Sets reason + * + * @param string|null $reason If the comment is hidden, the reason why this one has been moderated + * + * @return $this + */ + public function setReason(?string $reason): static + { + if (is_null($reason)) { + throw new InvalidArgumentException('non-nullable reason cannot be null'); + } + $allowedValues = self::getReasonAllowableValues(); + if (!in_array($reason, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'reason', must be one of '%s'", + $reason, + implode("', '", $allowedValues) + ) + ); + } + $this->container['reason'] = $reason; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreCommentUpdate.php b/src/Model/ScoreCommentUpdate.php new file mode 100644 index 0000000..492a13f --- /dev/null +++ b/src/Model/ScoreCommentUpdate.php @@ -0,0 +1,517 @@ + + */ +class ScoreCommentUpdate implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreCommentUpdate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'revision' => 'string', + 'comment' => 'string', + 'raw_comment' => 'string', + 'context' => '\Flat\APIClient\Model\ScoreCommentContext' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'revision' => null, + 'comment' => null, + 'raw_comment' => null, + 'context' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'revision' => false, + 'comment' => false, + 'raw_comment' => false, + 'context' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'revision' => 'revision', + 'comment' => 'comment', + 'raw_comment' => 'rawComment', + 'context' => 'context' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'revision' => 'setRevision', + 'comment' => 'setComment', + 'raw_comment' => 'setRawComment', + 'context' => 'setContext' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'revision' => 'getRevision', + 'comment' => 'getComment', + 'raw_comment' => 'getRawComment', + 'context' => 'getContext' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('revision', $data ?? [], null); + $this->setIfExists('comment', $data ?? [], null); + $this->setIfExists('raw_comment', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['comment']) && (mb_strlen($this->container['comment']) > 10000)) { + $invalidProperties[] = "invalid value for 'comment', the character length must be smaller than or equal to 10000."; + } + + if (!is_null($this->container['comment']) && (mb_strlen($this->container['comment']) < 1)) { + $invalidProperties[] = "invalid value for 'comment', the character length must be bigger than or equal to 1."; + } + + if (!is_null($this->container['raw_comment']) && (mb_strlen($this->container['raw_comment']) > 10000)) { + $invalidProperties[] = "invalid value for 'raw_comment', the character length must be smaller than or equal to 10000."; + } + + if (!is_null($this->container['raw_comment']) && (mb_strlen($this->container['raw_comment']) < 1)) { + $invalidProperties[] = "invalid value for 'raw_comment', the character length must be bigger than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets revision + * + * @return string|null + */ + public function getRevision(): ?string + { + return $this->container['revision']; + } + + /** + * Sets revision + * + * @param string|null $revision The unique identifier of the revision of the score where the comment was added. If this property is unspecified or contains \"last\", the API will automatically take the last revision created. + * + * @return $this + */ + public function setRevision(?string $revision): static + { + if (is_null($revision)) { + throw new InvalidArgumentException('non-nullable revision cannot be null'); + } + $this->container['revision'] = $revision; + + return $this; + } + + /** + * Gets comment + * + * @return string|null + */ + public function getComment(): ?string + { + return $this->container['comment']; + } + + /** + * Sets comment + * + * @param string|null $comment The comment text that can includes mentions using the following format: `@[id:username]`. + * + * @return $this + */ + public function setComment(?string $comment): static + { + if (is_null($comment)) { + throw new InvalidArgumentException('non-nullable comment cannot be null'); + } + if ((mb_strlen($comment) > 10000)) { + throw new InvalidArgumentException('invalid length for $comment when calling ScoreCommentUpdate., must be smaller than or equal to 10000.'); + } + if ((mb_strlen($comment) < 1)) { + throw new InvalidArgumentException('invalid length for $comment when calling ScoreCommentUpdate., must be bigger than or equal to 1.'); + } + + $this->container['comment'] = $comment; + + return $this; + } + + /** + * Gets raw_comment + * + * @return string|null + */ + public function getRawComment(): ?string + { + return $this->container['raw_comment']; + } + + /** + * Sets raw_comment + * + * @param string|null $raw_comment A raw version of the comment, that can be displayed without the mentions. If you use mentions, this property must be set. + * + * @return $this + */ + public function setRawComment(?string $raw_comment): static + { + if (is_null($raw_comment)) { + throw new InvalidArgumentException('non-nullable raw_comment cannot be null'); + } + if ((mb_strlen($raw_comment) > 10000)) { + throw new InvalidArgumentException('invalid length for $raw_comment when calling ScoreCommentUpdate., must be smaller than or equal to 10000.'); + } + if ((mb_strlen($raw_comment) < 1)) { + throw new InvalidArgumentException('invalid length for $raw_comment when calling ScoreCommentUpdate., must be bigger than or equal to 1.'); + } + + $this->container['raw_comment'] = $raw_comment; + + return $this; + } + + /** + * Gets context + * + * @return \Flat\APIClient\Model\ScoreCommentContext|null + */ + public function getContext(): ?\Flat\APIClient\Model\ScoreCommentContext + { + return $this->container['context']; + } + + /** + * Sets context + * + * @param \Flat\APIClient\Model\ScoreCommentContext|null $context context + * + * @return $this + */ + public function setContext(?\Flat\APIClient\Model\ScoreCommentContext $context): static + { + if (is_null($context)) { + throw new InvalidArgumentException('non-nullable context cannot be null'); + } + $this->container['context'] = $context; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreCommentsCounts.php b/src/Model/ScoreCommentsCounts.php new file mode 100644 index 0000000..f471367 --- /dev/null +++ b/src/Model/ScoreCommentsCounts.php @@ -0,0 +1,521 @@ + + */ +class ScoreCommentsCounts implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreCommentsCounts'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'total' => 'float', + 'unique' => 'float', + 'weekly' => 'float', + 'monthly' => 'float', + 'yearly' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'total' => null, + 'unique' => null, + 'weekly' => null, + 'monthly' => null, + 'yearly' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'total' => false, + 'unique' => false, + 'weekly' => false, + 'monthly' => false, + 'yearly' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'total' => 'total', + 'unique' => 'unique', + 'weekly' => 'weekly', + 'monthly' => 'monthly', + 'yearly' => 'yearly' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'total' => 'setTotal', + 'unique' => 'setUnique', + 'weekly' => 'setWeekly', + 'monthly' => 'setMonthly', + 'yearly' => 'setYearly' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'total' => 'getTotal', + 'unique' => 'getUnique', + 'weekly' => 'getWeekly', + 'monthly' => 'getMonthly', + 'yearly' => 'getYearly' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('unique', $data ?? [], null); + $this->setIfExists('weekly', $data ?? [], null); + $this->setIfExists('monthly', $data ?? [], null); + $this->setIfExists('yearly', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets total + * + * @return float|null + */ + public function getTotal(): ?float + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param float|null $total The total number of comments added to the score + * + * @return $this + */ + public function setTotal(?float $total): static + { + if (is_null($total)) { + throw new InvalidArgumentException('non-nullable total cannot be null'); + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets unique + * + * @return float|null + */ + public function getUnique(): ?float + { + return $this->container['unique']; + } + + /** + * Sets unique + * + * @param float|null $unique The unique (1/user) number of comments added to the score + * + * @return $this + */ + public function setUnique(?float $unique): static + { + if (is_null($unique)) { + throw new InvalidArgumentException('non-nullable unique cannot be null'); + } + $this->container['unique'] = $unique; + + return $this; + } + + /** + * Gets weekly + * + * @return float|null + */ + public function getWeekly(): ?float + { + return $this->container['weekly']; + } + + /** + * Sets weekly + * + * @param float|null $weekly The weekly unique number of comments added to the score + * + * @return $this + */ + public function setWeekly(?float $weekly): static + { + if (is_null($weekly)) { + throw new InvalidArgumentException('non-nullable weekly cannot be null'); + } + $this->container['weekly'] = $weekly; + + return $this; + } + + /** + * Gets monthly + * + * @return float|null + */ + public function getMonthly(): ?float + { + return $this->container['monthly']; + } + + /** + * Sets monthly + * + * @param float|null $monthly The monthly unique number of comments added to the score + * + * @return $this + */ + public function setMonthly(?float $monthly): static + { + if (is_null($monthly)) { + throw new InvalidArgumentException('non-nullable monthly cannot be null'); + } + $this->container['monthly'] = $monthly; + + return $this; + } + + /** + * Gets yearly + * + * @return float|null + */ + public function getYearly(): ?float + { + return $this->container['yearly']; + } + + /** + * Sets yearly + * + * @param float|null $yearly The yearly unique number of comments added to the score + * + * @return $this + */ + public function setYearly(?float $yearly): static + { + if (is_null($yearly)) { + throw new InvalidArgumentException('non-nullable yearly cannot be null'); + } + $this->container['yearly'] = $yearly; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreCreation.php b/src/Model/ScoreCreation.php new file mode 100644 index 0000000..4c534ed --- /dev/null +++ b/src/Model/ScoreCreation.php @@ -0,0 +1,85 @@ + + */ +class ScoreCreationBuilderData implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreCreationBuilderData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'title' => 'string', + 'privacy' => '\Flat\APIClient\Model\ScorePrivacy', + 'collection' => 'string', + 'google_drive_folder' => 'string', + 'builder_data' => '\Flat\APIClient\Model\ScoreCreationBuilderDataAllOfBuilderData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'title' => null, + 'privacy' => null, + 'collection' => null, + 'google_drive_folder' => null, + 'builder_data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'title' => false, + 'privacy' => false, + 'collection' => false, + 'google_drive_folder' => false, + 'builder_data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'title' => 'title', + 'privacy' => 'privacy', + 'collection' => 'collection', + 'google_drive_folder' => 'googleDriveFolder', + 'builder_data' => 'builderData' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'title' => 'setTitle', + 'privacy' => 'setPrivacy', + 'collection' => 'setCollection', + 'google_drive_folder' => 'setGoogleDriveFolder', + 'builder_data' => 'setBuilderData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'title' => 'getTitle', + 'privacy' => 'getPrivacy', + 'collection' => 'getCollection', + 'google_drive_folder' => 'getGoogleDriveFolder', + 'builder_data' => 'getBuilderData' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('privacy', $data ?? [], null); + $this->setIfExists('collection', $data ?? [], null); + $this->setIfExists('google_drive_folder', $data ?? [], null); + $this->setIfExists('builder_data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['builder_data'] === null) { + $invalidProperties[] = "'builder_data' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets title + * + * @return string|null + */ + public function getTitle(): ?string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the new score. If the title is too long, the API may trim this one. If this title is not specified, the API will try to (in this order): - Use the title contained in the file (e.g. [`movement-title`](https://usermanuals.musicxml.com/MusicXML/Content/EL-MusicXML-movement-title.htm) or [`credit-words`](https://usermanuals.musicxml.com/MusicXML/Content/EL-MusicXML-credit-words.htm) for [MusicXML](http://www.musicxml.com/) files). - Use the name of the file for files from a specified `source` (e.g. Google Drive) or the one in the `filename` property - Set a default title (e.g. \"New Music Score\") + * + * @return $this + */ + public function setTitle(?string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets privacy + * + * @return \Flat\APIClient\Model\ScorePrivacy|null + */ + public function getPrivacy(): ?\Flat\APIClient\Model\ScorePrivacy + { + return $this->container['privacy']; + } + + /** + * Sets privacy + * + * @param \Flat\APIClient\Model\ScorePrivacy|null $privacy privacy + * + * @return $this + */ + public function setPrivacy(?\Flat\APIClient\Model\ScorePrivacy $privacy): static + { + if (is_null($privacy)) { + throw new InvalidArgumentException('non-nullable privacy cannot be null'); + } + $this->container['privacy'] = $privacy; + + return $this; + } + + /** + * Gets collection + * + * @return string|null + */ + public function getCollection(): ?string + { + return $this->container['collection']; + } + + /** + * Sets collection + * + * @param string|null $collection Unique identifier of a collection where the score will be created. If no collection identifier is provided, the score will not be added to any collection and will only be visible in the `allScores` virtual collection. + * + * @return $this + */ + public function setCollection(?string $collection): static + { + if (is_null($collection)) { + throw new InvalidArgumentException('non-nullable collection cannot be null'); + } + $this->container['collection'] = $collection; + + return $this; + } + + /** + * Gets google_drive_folder + * + * @return string|null + */ + public function getGoogleDriveFolder(): ?string + { + return $this->container['google_drive_folder']; + } + + /** + * Sets google_drive_folder + * + * @param string|null $google_drive_folder If the user uses Google Drive and this properties is specified, the file will be created in this directory. The currently user creating the file must be granted to write in this directory. + * + * @return $this + */ + public function setGoogleDriveFolder(?string $google_drive_folder): static + { + if (is_null($google_drive_folder)) { + throw new InvalidArgumentException('non-nullable google_drive_folder cannot be null'); + } + $this->container['google_drive_folder'] = $google_drive_folder; + + return $this; + } + + /** + * Gets builder_data + * + * @return \Flat\APIClient\Model\ScoreCreationBuilderDataAllOfBuilderData + */ + public function getBuilderData(): \Flat\APIClient\Model\ScoreCreationBuilderDataAllOfBuilderData + { + return $this->container['builder_data']; + } + + /** + * Sets builder_data + * + * @param \Flat\APIClient\Model\ScoreCreationBuilderDataAllOfBuilderData $builder_data builder_data + * + * @return $this + */ + public function setBuilderData(\Flat\APIClient\Model\ScoreCreationBuilderDataAllOfBuilderData $builder_data): static + { + if (is_null($builder_data)) { + throw new InvalidArgumentException('non-nullable builder_data cannot be null'); + } + $this->container['builder_data'] = $builder_data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreCreationBuilderDataAllOfBuilderData.php b/src/Model/ScoreCreationBuilderDataAllOfBuilderData.php new file mode 100644 index 0000000..a4bc8bd --- /dev/null +++ b/src/Model/ScoreCreationBuilderDataAllOfBuilderData.php @@ -0,0 +1,421 @@ + + */ +class ScoreCreationBuilderDataAllOfBuilderData implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreCreationBuilderData_allOf_builderData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'score_data' => '\Flat\APIClient\Model\ScoreCreationBuilderDataAllOfBuilderDataScoreData', + 'layout_data' => '\Flat\APIClient\Model\ScoreCreationBuilderDataAllOfBuilderDataLayoutData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'score_data' => null, + 'layout_data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'score_data' => false, + 'layout_data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'score_data' => 'scoreData', + 'layout_data' => 'layoutData' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'score_data' => 'setScoreData', + 'layout_data' => 'setLayoutData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'score_data' => 'getScoreData', + 'layout_data' => 'getLayoutData' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('score_data', $data ?? [], null); + $this->setIfExists('layout_data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['score_data'] === null) { + $invalidProperties[] = "'score_data' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets score_data + * + * @return \Flat\APIClient\Model\ScoreCreationBuilderDataAllOfBuilderDataScoreData + */ + public function getScoreData(): \Flat\APIClient\Model\ScoreCreationBuilderDataAllOfBuilderDataScoreData + { + return $this->container['score_data']; + } + + /** + * Sets score_data + * + * @param \Flat\APIClient\Model\ScoreCreationBuilderDataAllOfBuilderDataScoreData $score_data score_data + * + * @return $this + */ + public function setScoreData(\Flat\APIClient\Model\ScoreCreationBuilderDataAllOfBuilderDataScoreData $score_data): static + { + if (is_null($score_data)) { + throw new InvalidArgumentException('non-nullable score_data cannot be null'); + } + $this->container['score_data'] = $score_data; + + return $this; + } + + /** + * Gets layout_data + * + * @return \Flat\APIClient\Model\ScoreCreationBuilderDataAllOfBuilderDataLayoutData|null + */ + public function getLayoutData(): ?\Flat\APIClient\Model\ScoreCreationBuilderDataAllOfBuilderDataLayoutData + { + return $this->container['layout_data']; + } + + /** + * Sets layout_data + * + * @param \Flat\APIClient\Model\ScoreCreationBuilderDataAllOfBuilderDataLayoutData|null $layout_data layout_data + * + * @return $this + */ + public function setLayoutData(?\Flat\APIClient\Model\ScoreCreationBuilderDataAllOfBuilderDataLayoutData $layout_data): static + { + if (is_null($layout_data)) { + throw new InvalidArgumentException('non-nullable layout_data cannot be null'); + } + $this->container['layout_data'] = $layout_data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreCreationBuilderDataAllOfBuilderDataLayoutData.php b/src/Model/ScoreCreationBuilderDataAllOfBuilderDataLayoutData.php new file mode 100644 index 0000000..59d7214 --- /dev/null +++ b/src/Model/ScoreCreationBuilderDataAllOfBuilderDataLayoutData.php @@ -0,0 +1,657 @@ + + */ +class ScoreCreationBuilderDataAllOfBuilderDataLayoutData implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreCreationBuilderData_allOf_builderData_layoutData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'notes_spacing_coeff' => 'float', + 'length_unit' => 'string', + 'page_height' => 'float', + 'page_width' => 'float', + 'page_margin_top' => 'float', + 'page_margin_bottom' => 'float', + 'page_margin_left' => 'float', + 'page_margin_right' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'notes_spacing_coeff' => null, + 'length_unit' => null, + 'page_height' => null, + 'page_width' => null, + 'page_margin_top' => null, + 'page_margin_bottom' => null, + 'page_margin_left' => null, + 'page_margin_right' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'notes_spacing_coeff' => false, + 'length_unit' => false, + 'page_height' => false, + 'page_width' => false, + 'page_margin_top' => false, + 'page_margin_bottom' => false, + 'page_margin_left' => false, + 'page_margin_right' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'notes_spacing_coeff' => 'notesSpacingCoeff', + 'length_unit' => 'lengthUnit', + 'page_height' => 'pageHeight', + 'page_width' => 'pageWidth', + 'page_margin_top' => 'pageMarginTop', + 'page_margin_bottom' => 'pageMarginBottom', + 'page_margin_left' => 'pageMarginLeft', + 'page_margin_right' => 'pageMarginRight' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'notes_spacing_coeff' => 'setNotesSpacingCoeff', + 'length_unit' => 'setLengthUnit', + 'page_height' => 'setPageHeight', + 'page_width' => 'setPageWidth', + 'page_margin_top' => 'setPageMarginTop', + 'page_margin_bottom' => 'setPageMarginBottom', + 'page_margin_left' => 'setPageMarginLeft', + 'page_margin_right' => 'setPageMarginRight' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'notes_spacing_coeff' => 'getNotesSpacingCoeff', + 'length_unit' => 'getLengthUnit', + 'page_height' => 'getPageHeight', + 'page_width' => 'getPageWidth', + 'page_margin_top' => 'getPageMarginTop', + 'page_margin_bottom' => 'getPageMarginBottom', + 'page_margin_left' => 'getPageMarginLeft', + 'page_margin_right' => 'getPageMarginRight' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const LENGTH_UNIT_CM = 'cm'; + public const LENGTH_UNIT_INCH = 'inch'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getLengthUnitAllowableValues() + { + return [ + self::LENGTH_UNIT_CM, + self::LENGTH_UNIT_INCH, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('notes_spacing_coeff', $data ?? [], null); + $this->setIfExists('length_unit', $data ?? [], 'cm'); + $this->setIfExists('page_height', $data ?? [], null); + $this->setIfExists('page_width', $data ?? [], null); + $this->setIfExists('page_margin_top', $data ?? [], null); + $this->setIfExists('page_margin_bottom', $data ?? [], null); + $this->setIfExists('page_margin_left', $data ?? [], null); + $this->setIfExists('page_margin_right', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + $allowedValues = self::getLengthUnitAllowableValues(); + if (!is_null($this->container['length_unit']) && !in_array($this->container['length_unit'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'length_unit', must be one of '%s'", + $this->container['length_unit'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets notes_spacing_coeff + * + * @return float|null + */ + public function getNotesSpacingCoeff(): ?float + { + return $this->container['notes_spacing_coeff']; + } + + /** + * Sets notes_spacing_coeff + * + * @param float|null $notes_spacing_coeff A float value >= 1 that controls the spacing between notes. + * + * @return $this + */ + public function setNotesSpacingCoeff(?float $notes_spacing_coeff): static + { + if (is_null($notes_spacing_coeff)) { + throw new InvalidArgumentException('non-nullable notes_spacing_coeff cannot be null'); + } + $this->container['notes_spacing_coeff'] = $notes_spacing_coeff; + + return $this; + } + + /** + * Gets length_unit + * + * @return string|null + */ + public function getLengthUnit(): ?string + { + return $this->container['length_unit']; + } + + /** + * Sets length_unit + * + * @param string|null $length_unit The unit to use for layout customizations + * + * @return $this + */ + public function setLengthUnit(?string $length_unit): static + { + if (is_null($length_unit)) { + throw new InvalidArgumentException('non-nullable length_unit cannot be null'); + } + $allowedValues = self::getLengthUnitAllowableValues(); + if (!in_array($length_unit, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'length_unit', must be one of '%s'", + $length_unit, + implode("', '", $allowedValues) + ) + ); + } + $this->container['length_unit'] = $length_unit; + + return $this; + } + + /** + * Gets page_height + * + * @return float|null + */ + public function getPageHeight(): ?float + { + return $this->container['page_height']; + } + + /** + * Sets page_height + * + * @param float|null $page_height The height of the page in chosen unit (`lengthUnit`). + * + * @return $this + */ + public function setPageHeight(?float $page_height): static + { + if (is_null($page_height)) { + throw new InvalidArgumentException('non-nullable page_height cannot be null'); + } + $this->container['page_height'] = $page_height; + + return $this; + } + + /** + * Gets page_width + * + * @return float|null + */ + public function getPageWidth(): ?float + { + return $this->container['page_width']; + } + + /** + * Sets page_width + * + * @param float|null $page_width The width of the page in chosen unit (`lengthUnit`). + * + * @return $this + */ + public function setPageWidth(?float $page_width): static + { + if (is_null($page_width)) { + throw new InvalidArgumentException('non-nullable page_width cannot be null'); + } + $this->container['page_width'] = $page_width; + + return $this; + } + + /** + * Gets page_margin_top + * + * @return float|null + */ + public function getPageMarginTop(): ?float + { + return $this->container['page_margin_top']; + } + + /** + * Sets page_margin_top + * + * @param float|null $page_margin_top The top margin of the page in chosen unit (`lengthUnit`). + * + * @return $this + */ + public function setPageMarginTop(?float $page_margin_top): static + { + if (is_null($page_margin_top)) { + throw new InvalidArgumentException('non-nullable page_margin_top cannot be null'); + } + $this->container['page_margin_top'] = $page_margin_top; + + return $this; + } + + /** + * Gets page_margin_bottom + * + * @return float|null + */ + public function getPageMarginBottom(): ?float + { + return $this->container['page_margin_bottom']; + } + + /** + * Sets page_margin_bottom + * + * @param float|null $page_margin_bottom The bottom margin of the page in chosen unit (`lengthUnit`). + * + * @return $this + */ + public function setPageMarginBottom(?float $page_margin_bottom): static + { + if (is_null($page_margin_bottom)) { + throw new InvalidArgumentException('non-nullable page_margin_bottom cannot be null'); + } + $this->container['page_margin_bottom'] = $page_margin_bottom; + + return $this; + } + + /** + * Gets page_margin_left + * + * @return float|null + */ + public function getPageMarginLeft(): ?float + { + return $this->container['page_margin_left']; + } + + /** + * Sets page_margin_left + * + * @param float|null $page_margin_left The left margin of the page in chosen unit (`lengthUnit`). + * + * @return $this + */ + public function setPageMarginLeft(?float $page_margin_left): static + { + if (is_null($page_margin_left)) { + throw new InvalidArgumentException('non-nullable page_margin_left cannot be null'); + } + $this->container['page_margin_left'] = $page_margin_left; + + return $this; + } + + /** + * Gets page_margin_right + * + * @return float|null + */ + public function getPageMarginRight(): ?float + { + return $this->container['page_margin_right']; + } + + /** + * Sets page_margin_right + * + * @param float|null $page_margin_right The right margin of the page in chosen unit (`lengthUnit`). + * + * @return $this + */ + public function setPageMarginRight(?float $page_margin_right): static + { + if (is_null($page_margin_right)) { + throw new InvalidArgumentException('non-nullable page_margin_right cannot be null'); + } + $this->container['page_margin_right'] = $page_margin_right; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreCreationBuilderDataAllOfBuilderDataScoreData.php b/src/Model/ScoreCreationBuilderDataAllOfBuilderDataScoreData.php new file mode 100644 index 0000000..23dc3e2 --- /dev/null +++ b/src/Model/ScoreCreationBuilderDataAllOfBuilderDataScoreData.php @@ -0,0 +1,557 @@ + + */ +class ScoreCreationBuilderDataAllOfBuilderDataScoreData implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreCreationBuilderData_allOf_builderData_scoreData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'use_tab_staff' => 'bool', + 'use_chord_grid' => 'bool', + 'fifths' => 'float', + 'nb_beats' => 'float', + 'beat_type' => 'float', + 'instruments' => '\Flat\APIClient\Model\ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'use_tab_staff' => null, + 'use_chord_grid' => null, + 'fifths' => null, + 'nb_beats' => null, + 'beat_type' => null, + 'instruments' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'use_tab_staff' => false, + 'use_chord_grid' => false, + 'fifths' => false, + 'nb_beats' => false, + 'beat_type' => false, + 'instruments' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'use_tab_staff' => 'useTabStaff', + 'use_chord_grid' => 'useChordGrid', + 'fifths' => 'fifths', + 'nb_beats' => 'nbBeats', + 'beat_type' => 'beatType', + 'instruments' => 'instruments' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'use_tab_staff' => 'setUseTabStaff', + 'use_chord_grid' => 'setUseChordGrid', + 'fifths' => 'setFifths', + 'nb_beats' => 'setNbBeats', + 'beat_type' => 'setBeatType', + 'instruments' => 'setInstruments' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'use_tab_staff' => 'getUseTabStaff', + 'use_chord_grid' => 'getUseChordGrid', + 'fifths' => 'getFifths', + 'nb_beats' => 'getNbBeats', + 'beat_type' => 'getBeatType', + 'instruments' => 'getInstruments' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('use_tab_staff', $data ?? [], null); + $this->setIfExists('use_chord_grid', $data ?? [], null); + $this->setIfExists('fifths', $data ?? [], null); + $this->setIfExists('nb_beats', $data ?? [], null); + $this->setIfExists('beat_type', $data ?? [], null); + $this->setIfExists('instruments', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['instruments'] === null) { + $invalidProperties[] = "'instruments' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets use_tab_staff + * + * @return bool|null + */ + public function getUseTabStaff(): ?bool + { + return $this->container['use_tab_staff']; + } + + /** + * Sets use_tab_staff + * + * @param bool|null $use_tab_staff true if the TAB staff is displayed with fretted instruments + * + * @return $this + */ + public function setUseTabStaff(?bool $use_tab_staff): static + { + if (is_null($use_tab_staff)) { + throw new InvalidArgumentException('non-nullable use_tab_staff cannot be null'); + } + $this->container['use_tab_staff'] = $use_tab_staff; + + return $this; + } + + /** + * Gets use_chord_grid + * + * @return bool|null + */ + public function getUseChordGrid(): ?bool + { + return $this->container['use_chord_grid']; + } + + /** + * Sets use_chord_grid + * + * @param bool|null $use_chord_grid true if the chord grid must be displayed with fretted instruments + * + * @return $this + */ + public function setUseChordGrid(?bool $use_chord_grid): static + { + if (is_null($use_chord_grid)) { + throw new InvalidArgumentException('non-nullable use_chord_grid cannot be null'); + } + $this->container['use_chord_grid'] = $use_chord_grid; + + return $this; + } + + /** + * Gets fifths + * + * @return float|null + */ + public function getFifths(): ?float + { + return $this->container['fifths']; + } + + /** + * Sets fifths + * + * @param float|null $fifths The key signature of the score (expressed between -7 and 7). Major C is used when the value is not provided. + * + * @return $this + */ + public function setFifths(?float $fifths): static + { + if (is_null($fifths)) { + throw new InvalidArgumentException('non-nullable fifths cannot be null'); + } + $this->container['fifths'] = $fifths; + + return $this; + } + + /** + * Gets nb_beats + * + * @return float|null + */ + public function getNbBeats(): ?float + { + return $this->container['nb_beats']; + } + + /** + * Sets nb_beats + * + * @param float|null $nb_beats The number of beats in the measure + * + * @return $this + */ + public function setNbBeats(?float $nb_beats): static + { + if (is_null($nb_beats)) { + throw new InvalidArgumentException('non-nullable nb_beats cannot be null'); + } + $this->container['nb_beats'] = $nb_beats; + + return $this; + } + + /** + * Gets beat_type + * + * @return float|null + */ + public function getBeatType(): ?float + { + return $this->container['beat_type']; + } + + /** + * Sets beat_type + * + * @param float|null $beat_type The duration of a beat in the measure + * + * @return $this + */ + public function setBeatType(?float $beat_type): static + { + if (is_null($beat_type)) { + throw new InvalidArgumentException('non-nullable beat_type cannot be null'); + } + $this->container['beat_type'] = $beat_type; + + return $this; + } + + /** + * Gets instruments + * + * @return \Flat\APIClient\Model\ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments[] + */ + public function getInstruments(): array + { + return $this->container['instruments']; + } + + /** + * Sets instruments + * + * @param \Flat\APIClient\Model\ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments[] $instruments The list of instruments to add to the score. See the [Instrument IDs reference](https://flat.io/developers/docs/api/instruments) for the possible values for `group` and `instrument` (also available as the [`@flat/instruments`](https://www.npmjs.com/package/@flat/instruments) package). + * + * @return $this + */ + public function setInstruments(array $instruments): static + { + if (is_null($instruments)) { + throw new InvalidArgumentException('non-nullable instruments cannot be null'); + } + $this->container['instruments'] = $instruments; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments.php b/src/Model/ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments.php new file mode 100644 index 0000000..b577e10 --- /dev/null +++ b/src/Model/ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments.php @@ -0,0 +1,526 @@ + + */ +class ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreCreationBuilderData_allOf_builderData_scoreData_instruments'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'group' => 'string', + 'instrument' => 'string', + 'long_name' => 'string', + 'short_name' => 'string', + 'has_quarter_tone' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'group' => null, + 'instrument' => null, + 'long_name' => null, + 'short_name' => null, + 'has_quarter_tone' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'group' => false, + 'instrument' => false, + 'long_name' => false, + 'short_name' => false, + 'has_quarter_tone' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'group' => 'group', + 'instrument' => 'instrument', + 'long_name' => 'longName', + 'short_name' => 'shortName', + 'has_quarter_tone' => 'hasQuarterTone' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'group' => 'setGroup', + 'instrument' => 'setInstrument', + 'long_name' => 'setLongName', + 'short_name' => 'setShortName', + 'has_quarter_tone' => 'setHasQuarterTone' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'group' => 'getGroup', + 'instrument' => 'getInstrument', + 'long_name' => 'getLongName', + 'short_name' => 'getShortName', + 'has_quarter_tone' => 'getHasQuarterTone' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('group', $data ?? [], null); + $this->setIfExists('instrument', $data ?? [], null); + $this->setIfExists('long_name', $data ?? [], null); + $this->setIfExists('short_name', $data ?? [], null); + $this->setIfExists('has_quarter_tone', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['group'] === null) { + $invalidProperties[] = "'group' can't be null"; + } + if ($this->container['instrument'] === null) { + $invalidProperties[] = "'instrument' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets group + * + * @return string + */ + public function getGroup(): string + { + return $this->container['group']; + } + + /** + * Sets group + * + * @param string $group The of the instrument group (e.g. `keyboards`, `brass`) + * + * @return $this + */ + public function setGroup(string $group): static + { + if (is_null($group)) { + throw new InvalidArgumentException('non-nullable group cannot be null'); + } + $this->container['group'] = $group; + + return $this; + } + + /** + * Gets instrument + * + * @return string + */ + public function getInstrument(): string + { + return $this->container['instrument']; + } + + /** + * Sets instrument + * + * @param string $instrument The identifier of the instrument (e.g. `piano`, `trumpet`) + * + * @return $this + */ + public function setInstrument(string $instrument): static + { + if (is_null($instrument)) { + throw new InvalidArgumentException('non-nullable instrument cannot be null'); + } + $this->container['instrument'] = $instrument; + + return $this; + } + + /** + * Gets long_name + * + * @return string|null + */ + public function getLongName(): ?string + { + return $this->container['long_name']; + } + + /** + * Sets long_name + * + * @param string|null $long_name The full name of the instrument + * + * @return $this + */ + public function setLongName(?string $long_name): static + { + if (is_null($long_name)) { + throw new InvalidArgumentException('non-nullable long_name cannot be null'); + } + $this->container['long_name'] = $long_name; + + return $this; + } + + /** + * Gets short_name + * + * @return string|null + */ + public function getShortName(): ?string + { + return $this->container['short_name']; + } + + /** + * Sets short_name + * + * @param string|null $short_name The abbreviation of the name of the instrument + * + * @return $this + */ + public function setShortName(?string $short_name): static + { + if (is_null($short_name)) { + throw new InvalidArgumentException('non-nullable short_name cannot be null'); + } + $this->container['short_name'] = $short_name; + + return $this; + } + + /** + * Gets has_quarter_tone + * + * @return bool|null + */ + public function getHasQuarterTone(): ?bool + { + return $this->container['has_quarter_tone']; + } + + /** + * Sets has_quarter_tone + * + * @param bool|null $has_quarter_tone True if the part can use quarter tone (prevent the part to have a TAB/chord grid) + * + * @return $this + */ + public function setHasQuarterTone(?bool $has_quarter_tone): static + { + if (is_null($has_quarter_tone)) { + throw new InvalidArgumentException('non-nullable has_quarter_tone cannot be null'); + } + $this->container['has_quarter_tone'] = $has_quarter_tone; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreCreationCommon.php b/src/Model/ScoreCreationCommon.php new file mode 100644 index 0000000..1d8a113 --- /dev/null +++ b/src/Model/ScoreCreationCommon.php @@ -0,0 +1,486 @@ + + */ +class ScoreCreationCommon implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreCreationCommon'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'title' => 'string', + 'privacy' => '\Flat\APIClient\Model\ScorePrivacy', + 'collection' => 'string', + 'google_drive_folder' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'title' => null, + 'privacy' => null, + 'collection' => null, + 'google_drive_folder' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'title' => false, + 'privacy' => false, + 'collection' => false, + 'google_drive_folder' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'title' => 'title', + 'privacy' => 'privacy', + 'collection' => 'collection', + 'google_drive_folder' => 'googleDriveFolder' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'title' => 'setTitle', + 'privacy' => 'setPrivacy', + 'collection' => 'setCollection', + 'google_drive_folder' => 'setGoogleDriveFolder' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'title' => 'getTitle', + 'privacy' => 'getPrivacy', + 'collection' => 'getCollection', + 'google_drive_folder' => 'getGoogleDriveFolder' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('privacy', $data ?? [], null); + $this->setIfExists('collection', $data ?? [], null); + $this->setIfExists('google_drive_folder', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets title + * + * @return string|null + */ + public function getTitle(): ?string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the new score. If the title is too long, the API may trim this one. If this title is not specified, the API will try to (in this order): - Use the title contained in the file (e.g. [`movement-title`](https://usermanuals.musicxml.com/MusicXML/Content/EL-MusicXML-movement-title.htm) or [`credit-words`](https://usermanuals.musicxml.com/MusicXML/Content/EL-MusicXML-credit-words.htm) for [MusicXML](http://www.musicxml.com/) files). - Use the name of the file for files from a specified `source` (e.g. Google Drive) or the one in the `filename` property - Set a default title (e.g. \"New Music Score\") + * + * @return $this + */ + public function setTitle(?string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets privacy + * + * @return \Flat\APIClient\Model\ScorePrivacy|null + */ + public function getPrivacy(): ?\Flat\APIClient\Model\ScorePrivacy + { + return $this->container['privacy']; + } + + /** + * Sets privacy + * + * @param \Flat\APIClient\Model\ScorePrivacy|null $privacy privacy + * + * @return $this + */ + public function setPrivacy(?\Flat\APIClient\Model\ScorePrivacy $privacy): static + { + if (is_null($privacy)) { + throw new InvalidArgumentException('non-nullable privacy cannot be null'); + } + $this->container['privacy'] = $privacy; + + return $this; + } + + /** + * Gets collection + * + * @return string|null + */ + public function getCollection(): ?string + { + return $this->container['collection']; + } + + /** + * Sets collection + * + * @param string|null $collection Unique identifier of a collection where the score will be created. If no collection identifier is provided, the score will not be added to any collection and will only be visible in the `allScores` virtual collection. + * + * @return $this + */ + public function setCollection(?string $collection): static + { + if (is_null($collection)) { + throw new InvalidArgumentException('non-nullable collection cannot be null'); + } + $this->container['collection'] = $collection; + + return $this; + } + + /** + * Gets google_drive_folder + * + * @return string|null + */ + public function getGoogleDriveFolder(): ?string + { + return $this->container['google_drive_folder']; + } + + /** + * Sets google_drive_folder + * + * @param string|null $google_drive_folder If the user uses Google Drive and this properties is specified, the file will be created in this directory. The currently user creating the file must be granted to write in this directory. + * + * @return $this + */ + public function setGoogleDriveFolder(?string $google_drive_folder): static + { + if (is_null($google_drive_folder)) { + throw new InvalidArgumentException('non-nullable google_drive_folder cannot be null'); + } + $this->container['google_drive_folder'] = $google_drive_folder; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreCreationFileImport.php b/src/Model/ScoreCreationFileImport.php new file mode 100644 index 0000000..e5b9575 --- /dev/null +++ b/src/Model/ScoreCreationFileImport.php @@ -0,0 +1,657 @@ + + */ +class ScoreCreationFileImport implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreCreationFileImport'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'title' => 'string', + 'privacy' => '\Flat\APIClient\Model\ScorePrivacy', + 'collection' => 'string', + 'google_drive_folder' => 'string', + 'filename' => 'string', + 'data' => 'string', + 'data_encoding' => 'string', + 'supports_tasks' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'title' => null, + 'privacy' => null, + 'collection' => null, + 'google_drive_folder' => null, + 'filename' => null, + 'data' => null, + 'data_encoding' => null, + 'supports_tasks' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'title' => false, + 'privacy' => false, + 'collection' => false, + 'google_drive_folder' => false, + 'filename' => false, + 'data' => false, + 'data_encoding' => false, + 'supports_tasks' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'title' => 'title', + 'privacy' => 'privacy', + 'collection' => 'collection', + 'google_drive_folder' => 'googleDriveFolder', + 'filename' => 'filename', + 'data' => 'data', + 'data_encoding' => 'dataEncoding', + 'supports_tasks' => 'supportsTasks' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'title' => 'setTitle', + 'privacy' => 'setPrivacy', + 'collection' => 'setCollection', + 'google_drive_folder' => 'setGoogleDriveFolder', + 'filename' => 'setFilename', + 'data' => 'setData', + 'data_encoding' => 'setDataEncoding', + 'supports_tasks' => 'setSupportsTasks' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'title' => 'getTitle', + 'privacy' => 'getPrivacy', + 'collection' => 'getCollection', + 'google_drive_folder' => 'getGoogleDriveFolder', + 'filename' => 'getFilename', + 'data' => 'getData', + 'data_encoding' => 'getDataEncoding', + 'supports_tasks' => 'getSupportsTasks' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const DATA_ENCODING_BASE64 = 'base64'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getDataEncodingAllowableValues() + { + return [ + self::DATA_ENCODING_BASE64, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('privacy', $data ?? [], null); + $this->setIfExists('collection', $data ?? [], null); + $this->setIfExists('google_drive_folder', $data ?? [], null); + $this->setIfExists('filename', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('data_encoding', $data ?? [], null); + $this->setIfExists('supports_tasks', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + $allowedValues = self::getDataEncodingAllowableValues(); + if (!is_null($this->container['data_encoding']) && !in_array($this->container['data_encoding'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'data_encoding', must be one of '%s'", + $this->container['data_encoding'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets title + * + * @return string|null + */ + public function getTitle(): ?string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the new score. If the title is too long, the API may trim this one. If this title is not specified, the API will try to (in this order): - Use the title contained in the file (e.g. [`movement-title`](https://usermanuals.musicxml.com/MusicXML/Content/EL-MusicXML-movement-title.htm) or [`credit-words`](https://usermanuals.musicxml.com/MusicXML/Content/EL-MusicXML-credit-words.htm) for [MusicXML](http://www.musicxml.com/) files). - Use the name of the file for files from a specified `source` (e.g. Google Drive) or the one in the `filename` property - Set a default title (e.g. \"New Music Score\") + * + * @return $this + */ + public function setTitle(?string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets privacy + * + * @return \Flat\APIClient\Model\ScorePrivacy|null + */ + public function getPrivacy(): ?\Flat\APIClient\Model\ScorePrivacy + { + return $this->container['privacy']; + } + + /** + * Sets privacy + * + * @param \Flat\APIClient\Model\ScorePrivacy|null $privacy privacy + * + * @return $this + */ + public function setPrivacy(?\Flat\APIClient\Model\ScorePrivacy $privacy): static + { + if (is_null($privacy)) { + throw new InvalidArgumentException('non-nullable privacy cannot be null'); + } + $this->container['privacy'] = $privacy; + + return $this; + } + + /** + * Gets collection + * + * @return string|null + */ + public function getCollection(): ?string + { + return $this->container['collection']; + } + + /** + * Sets collection + * + * @param string|null $collection Unique identifier of a collection where the score will be created. If no collection identifier is provided, the score will not be added to any collection and will only be visible in the `allScores` virtual collection. + * + * @return $this + */ + public function setCollection(?string $collection): static + { + if (is_null($collection)) { + throw new InvalidArgumentException('non-nullable collection cannot be null'); + } + $this->container['collection'] = $collection; + + return $this; + } + + /** + * Gets google_drive_folder + * + * @return string|null + */ + public function getGoogleDriveFolder(): ?string + { + return $this->container['google_drive_folder']; + } + + /** + * Sets google_drive_folder + * + * @param string|null $google_drive_folder If the user uses Google Drive and this properties is specified, the file will be created in this directory. The currently user creating the file must be granted to write in this directory. + * + * @return $this + */ + public function setGoogleDriveFolder(?string $google_drive_folder): static + { + if (is_null($google_drive_folder)) { + throw new InvalidArgumentException('non-nullable google_drive_folder cannot be null'); + } + $this->container['google_drive_folder'] = $google_drive_folder; + + return $this; + } + + /** + * Gets filename + * + * @return string|null + */ + public function getFilename(): ?string + { + return $this->container['filename']; + } + + /** + * Sets filename + * + * @param string|null $filename If this is an imported file, its filename + * + * @return $this + */ + public function setFilename(?string $filename): static + { + if (is_null($filename)) { + throw new InvalidArgumentException('non-nullable filename cannot be null'); + } + $this->container['filename'] = $filename; + + return $this; + } + + /** + * Gets data + * + * @return string + */ + public function getData(): string + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param string $data The data of the score file. See the `POST /scores` endpoint description for the full list of supported formats. Binary payloads (e.g. compressed MusicXML, MIDI, Guitar Pro) can be encoded in Base64, in this case the `dataEncoding` property must match the encoding used for the API request. + * + * @return $this + */ + public function setData(string $data): static + { + if (is_null($data)) { + throw new InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets data_encoding + * + * @return string|null + */ + public function getDataEncoding(): ?string + { + return $this->container['data_encoding']; + } + + /** + * Sets data_encoding + * + * @param string|null $data_encoding The optional encoding of the score data. This property must match the encoding used for the `data` property. + * + * @return $this + */ + public function setDataEncoding(?string $data_encoding): static + { + if (is_null($data_encoding)) { + throw new InvalidArgumentException('non-nullable data_encoding cannot be null'); + } + $allowedValues = self::getDataEncodingAllowableValues(); + if (!in_array($data_encoding, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'data_encoding', must be one of '%s'", + $data_encoding, + implode("', '", $allowedValues) + ) + ); + } + $this->container['data_encoding'] = $data_encoding; + + return $this; + } + + /** + * Gets supports_tasks + * + * @return bool|null + */ + public function getSupportsTasks(): ?bool + { + return $this->container['supports_tasks']; + } + + /** + * Sets supports_tasks + * + * @param bool|null $supports_tasks Set this to `true` if the client supports asynchronous task flows. When importing a score that requires OMR processing (a PDF or a page image), the API will return a 202 Accepted response along with a task reference. The client can then check the task status using the endpoint `GET /v2/tasks/{task}`. + * + * @return $this + */ + public function setSupportsTasks(?bool $supports_tasks): static + { + if (is_null($supports_tasks)) { + throw new InvalidArgumentException('non-nullable supports_tasks cannot be null'); + } + $this->container['supports_tasks'] = $supports_tasks; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreCreationGoogleDriveImport.php b/src/Model/ScoreCreationGoogleDriveImport.php new file mode 100644 index 0000000..5089196 --- /dev/null +++ b/src/Model/ScoreCreationGoogleDriveImport.php @@ -0,0 +1,523 @@ + + */ +class ScoreCreationGoogleDriveImport implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreCreationGoogleDriveImport'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'title' => 'string', + 'privacy' => '\Flat\APIClient\Model\ScorePrivacy', + 'collection' => 'string', + 'google_drive_folder' => 'string', + 'source' => '\Flat\APIClient\Model\ScoreSource' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'title' => null, + 'privacy' => null, + 'collection' => null, + 'google_drive_folder' => null, + 'source' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'title' => false, + 'privacy' => false, + 'collection' => false, + 'google_drive_folder' => false, + 'source' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'title' => 'title', + 'privacy' => 'privacy', + 'collection' => 'collection', + 'google_drive_folder' => 'googleDriveFolder', + 'source' => 'source' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'title' => 'setTitle', + 'privacy' => 'setPrivacy', + 'collection' => 'setCollection', + 'google_drive_folder' => 'setGoogleDriveFolder', + 'source' => 'setSource' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'title' => 'getTitle', + 'privacy' => 'getPrivacy', + 'collection' => 'getCollection', + 'google_drive_folder' => 'getGoogleDriveFolder', + 'source' => 'getSource' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('privacy', $data ?? [], null); + $this->setIfExists('collection', $data ?? [], null); + $this->setIfExists('google_drive_folder', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['source'] === null) { + $invalidProperties[] = "'source' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets title + * + * @return string|null + */ + public function getTitle(): ?string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the new score. If the title is too long, the API may trim this one. If this title is not specified, the API will try to (in this order): - Use the title contained in the file (e.g. [`movement-title`](https://usermanuals.musicxml.com/MusicXML/Content/EL-MusicXML-movement-title.htm) or [`credit-words`](https://usermanuals.musicxml.com/MusicXML/Content/EL-MusicXML-credit-words.htm) for [MusicXML](http://www.musicxml.com/) files). - Use the name of the file for files from a specified `source` (e.g. Google Drive) or the one in the `filename` property - Set a default title (e.g. \"New Music Score\") + * + * @return $this + */ + public function setTitle(?string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets privacy + * + * @return \Flat\APIClient\Model\ScorePrivacy|null + */ + public function getPrivacy(): ?\Flat\APIClient\Model\ScorePrivacy + { + return $this->container['privacy']; + } + + /** + * Sets privacy + * + * @param \Flat\APIClient\Model\ScorePrivacy|null $privacy privacy + * + * @return $this + */ + public function setPrivacy(?\Flat\APIClient\Model\ScorePrivacy $privacy): static + { + if (is_null($privacy)) { + throw new InvalidArgumentException('non-nullable privacy cannot be null'); + } + $this->container['privacy'] = $privacy; + + return $this; + } + + /** + * Gets collection + * + * @return string|null + */ + public function getCollection(): ?string + { + return $this->container['collection']; + } + + /** + * Sets collection + * + * @param string|null $collection Unique identifier of a collection where the score will be created. If no collection identifier is provided, the score will not be added to any collection and will only be visible in the `allScores` virtual collection. + * + * @return $this + */ + public function setCollection(?string $collection): static + { + if (is_null($collection)) { + throw new InvalidArgumentException('non-nullable collection cannot be null'); + } + $this->container['collection'] = $collection; + + return $this; + } + + /** + * Gets google_drive_folder + * + * @return string|null + */ + public function getGoogleDriveFolder(): ?string + { + return $this->container['google_drive_folder']; + } + + /** + * Sets google_drive_folder + * + * @param string|null $google_drive_folder If the user uses Google Drive and this properties is specified, the file will be created in this directory. The currently user creating the file must be granted to write in this directory. + * + * @return $this + */ + public function setGoogleDriveFolder(?string $google_drive_folder): static + { + if (is_null($google_drive_folder)) { + throw new InvalidArgumentException('non-nullable google_drive_folder cannot be null'); + } + $this->container['google_drive_folder'] = $google_drive_folder; + + return $this; + } + + /** + * Gets source + * + * @return \Flat\APIClient\Model\ScoreSource + */ + public function getSource(): \Flat\APIClient\Model\ScoreSource + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param \Flat\APIClient\Model\ScoreSource $source source + * + * @return $this + */ + public function setSource(\Flat\APIClient\Model\ScoreSource $source): static + { + if (is_null($source)) { + throw new InvalidArgumentException('non-nullable source cannot be null'); + } + $this->container['source'] = $source; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreCreationType.php b/src/Model/ScoreCreationType.php new file mode 100644 index 0000000..0881ed0 --- /dev/null +++ b/src/Model/ScoreCreationType.php @@ -0,0 +1,48 @@ + + */ +class ScoreDetails implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'sharing_key' => 'string', + 'title' => 'string', + 'privacy' => '\Flat\APIClient\Model\ScorePrivacy', + 'user' => '\Flat\APIClient\Model\UserPublic', + 'html_url' => 'string', + 'edit_html_url' => 'string', + 'subtitle' => 'string', + 'lyricist' => 'string', + 'arranger' => 'string', + 'composer' => 'string', + 'description' => 'string', + 'tags' => 'string[]', + 'creation_type' => '\Flat\APIClient\Model\ScoreCreationType', + 'license' => '\Flat\APIClient\Model\ScoreLicense', + 'license_text' => 'string', + 'duration_time' => 'float', + 'number_measures' => 'int', + 'main_tempo_qpm' => 'float', + 'main_key_signature' => 'float', + 'rights' => '\Flat\APIClient\Model\ResourceRights', + 'collaborators' => '\Flat\APIClient\Model\ResourceCollaborator[]', + 'creation_date' => '\DateTime', + 'modification_date' => '\DateTime', + 'publication_date' => '\DateTime', + 'scheduled_deletion_date' => '\DateTime', + 'highlighted_date' => '\DateTime', + 'organization' => 'string', + 'parent_score' => 'string', + 'instruments' => 'string[]', + 'instruments_names' => 'string[]', + 'samples' => 'string[]', + 'google_drive_file_id' => 'string', + 'likes' => '\Flat\APIClient\Model\ScoreLikesCounts', + 'comments' => '\Flat\APIClient\Model\ScoreCommentsCounts', + 'views' => '\Flat\APIClient\Model\ScoreViewsCounts', + 'plays' => '\Flat\APIClient\Model\ScorePlaysCounts', + 'collections' => 'string[]', + 'me' => '\Flat\APIClient\Model\ScoreDetailsAllOfMe' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'sharing_key' => null, + 'title' => null, + 'privacy' => null, + 'user' => null, + 'html_url' => 'url', + 'edit_html_url' => 'url', + 'subtitle' => null, + 'lyricist' => null, + 'arranger' => null, + 'composer' => null, + 'description' => null, + 'tags' => null, + 'creation_type' => null, + 'license' => null, + 'license_text' => null, + 'duration_time' => null, + 'number_measures' => null, + 'main_tempo_qpm' => null, + 'main_key_signature' => null, + 'rights' => null, + 'collaborators' => null, + 'creation_date' => 'date-time', + 'modification_date' => 'date-time', + 'publication_date' => 'date-time', + 'scheduled_deletion_date' => 'date-time', + 'highlighted_date' => 'date-time', + 'organization' => null, + 'parent_score' => null, + 'instruments' => null, + 'instruments_names' => null, + 'samples' => null, + 'google_drive_file_id' => null, + 'likes' => null, + 'comments' => null, + 'views' => null, + 'plays' => null, + 'collections' => null, + 'me' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'sharing_key' => false, + 'title' => false, + 'privacy' => false, + 'user' => false, + 'html_url' => false, + 'edit_html_url' => false, + 'subtitle' => false, + 'lyricist' => false, + 'arranger' => false, + 'composer' => false, + 'description' => false, + 'tags' => false, + 'creation_type' => true, + 'license' => true, + 'license_text' => false, + 'duration_time' => false, + 'number_measures' => false, + 'main_tempo_qpm' => false, + 'main_key_signature' => false, + 'rights' => false, + 'collaborators' => false, + 'creation_date' => false, + 'modification_date' => false, + 'publication_date' => false, + 'scheduled_deletion_date' => false, + 'highlighted_date' => false, + 'organization' => false, + 'parent_score' => false, + 'instruments' => false, + 'instruments_names' => false, + 'samples' => false, + 'google_drive_file_id' => false, + 'likes' => false, + 'comments' => false, + 'views' => false, + 'plays' => false, + 'collections' => false, + 'me' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'sharing_key' => 'sharingKey', + 'title' => 'title', + 'privacy' => 'privacy', + 'user' => 'user', + 'html_url' => 'htmlUrl', + 'edit_html_url' => 'editHtmlUrl', + 'subtitle' => 'subtitle', + 'lyricist' => 'lyricist', + 'arranger' => 'arranger', + 'composer' => 'composer', + 'description' => 'description', + 'tags' => 'tags', + 'creation_type' => 'creationType', + 'license' => 'license', + 'license_text' => 'licenseText', + 'duration_time' => 'durationTime', + 'number_measures' => 'numberMeasures', + 'main_tempo_qpm' => 'mainTempoQpm', + 'main_key_signature' => 'mainKeySignature', + 'rights' => 'rights', + 'collaborators' => 'collaborators', + 'creation_date' => 'creationDate', + 'modification_date' => 'modificationDate', + 'publication_date' => 'publicationDate', + 'scheduled_deletion_date' => 'scheduledDeletionDate', + 'highlighted_date' => 'highlightedDate', + 'organization' => 'organization', + 'parent_score' => 'parentScore', + 'instruments' => 'instruments', + 'instruments_names' => 'instrumentsNames', + 'samples' => 'samples', + 'google_drive_file_id' => 'googleDriveFileId', + 'likes' => 'likes', + 'comments' => 'comments', + 'views' => 'views', + 'plays' => 'plays', + 'collections' => 'collections', + 'me' => 'me' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'sharing_key' => 'setSharingKey', + 'title' => 'setTitle', + 'privacy' => 'setPrivacy', + 'user' => 'setUser', + 'html_url' => 'setHtmlUrl', + 'edit_html_url' => 'setEditHtmlUrl', + 'subtitle' => 'setSubtitle', + 'lyricist' => 'setLyricist', + 'arranger' => 'setArranger', + 'composer' => 'setComposer', + 'description' => 'setDescription', + 'tags' => 'setTags', + 'creation_type' => 'setCreationType', + 'license' => 'setLicense', + 'license_text' => 'setLicenseText', + 'duration_time' => 'setDurationTime', + 'number_measures' => 'setNumberMeasures', + 'main_tempo_qpm' => 'setMainTempoQpm', + 'main_key_signature' => 'setMainKeySignature', + 'rights' => 'setRights', + 'collaborators' => 'setCollaborators', + 'creation_date' => 'setCreationDate', + 'modification_date' => 'setModificationDate', + 'publication_date' => 'setPublicationDate', + 'scheduled_deletion_date' => 'setScheduledDeletionDate', + 'highlighted_date' => 'setHighlightedDate', + 'organization' => 'setOrganization', + 'parent_score' => 'setParentScore', + 'instruments' => 'setInstruments', + 'instruments_names' => 'setInstrumentsNames', + 'samples' => 'setSamples', + 'google_drive_file_id' => 'setGoogleDriveFileId', + 'likes' => 'setLikes', + 'comments' => 'setComments', + 'views' => 'setViews', + 'plays' => 'setPlays', + 'collections' => 'setCollections', + 'me' => 'setMe' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'sharing_key' => 'getSharingKey', + 'title' => 'getTitle', + 'privacy' => 'getPrivacy', + 'user' => 'getUser', + 'html_url' => 'getHtmlUrl', + 'edit_html_url' => 'getEditHtmlUrl', + 'subtitle' => 'getSubtitle', + 'lyricist' => 'getLyricist', + 'arranger' => 'getArranger', + 'composer' => 'getComposer', + 'description' => 'getDescription', + 'tags' => 'getTags', + 'creation_type' => 'getCreationType', + 'license' => 'getLicense', + 'license_text' => 'getLicenseText', + 'duration_time' => 'getDurationTime', + 'number_measures' => 'getNumberMeasures', + 'main_tempo_qpm' => 'getMainTempoQpm', + 'main_key_signature' => 'getMainKeySignature', + 'rights' => 'getRights', + 'collaborators' => 'getCollaborators', + 'creation_date' => 'getCreationDate', + 'modification_date' => 'getModificationDate', + 'publication_date' => 'getPublicationDate', + 'scheduled_deletion_date' => 'getScheduledDeletionDate', + 'highlighted_date' => 'getHighlightedDate', + 'organization' => 'getOrganization', + 'parent_score' => 'getParentScore', + 'instruments' => 'getInstruments', + 'instruments_names' => 'getInstrumentsNames', + 'samples' => 'getSamples', + 'google_drive_file_id' => 'getGoogleDriveFileId', + 'likes' => 'getLikes', + 'comments' => 'getComments', + 'views' => 'getViews', + 'plays' => 'getPlays', + 'collections' => 'getCollections', + 'me' => 'getMe' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('sharing_key', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('privacy', $data ?? [], null); + $this->setIfExists('user', $data ?? [], null); + $this->setIfExists('html_url', $data ?? [], null); + $this->setIfExists('edit_html_url', $data ?? [], null); + $this->setIfExists('subtitle', $data ?? [], null); + $this->setIfExists('lyricist', $data ?? [], null); + $this->setIfExists('arranger', $data ?? [], null); + $this->setIfExists('composer', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('tags', $data ?? [], null); + $this->setIfExists('creation_type', $data ?? [], null); + $this->setIfExists('license', $data ?? [], null); + $this->setIfExists('license_text', $data ?? [], null); + $this->setIfExists('duration_time', $data ?? [], null); + $this->setIfExists('number_measures', $data ?? [], null); + $this->setIfExists('main_tempo_qpm', $data ?? [], null); + $this->setIfExists('main_key_signature', $data ?? [], null); + $this->setIfExists('rights', $data ?? [], null); + $this->setIfExists('collaborators', $data ?? [], null); + $this->setIfExists('creation_date', $data ?? [], null); + $this->setIfExists('modification_date', $data ?? [], null); + $this->setIfExists('publication_date', $data ?? [], null); + $this->setIfExists('scheduled_deletion_date', $data ?? [], null); + $this->setIfExists('highlighted_date', $data ?? [], null); + $this->setIfExists('organization', $data ?? [], null); + $this->setIfExists('parent_score', $data ?? [], null); + $this->setIfExists('instruments', $data ?? [], null); + $this->setIfExists('instruments_names', $data ?? [], null); + $this->setIfExists('samples', $data ?? [], null); + $this->setIfExists('google_drive_file_id', $data ?? [], null); + $this->setIfExists('likes', $data ?? [], null); + $this->setIfExists('comments', $data ?? [], null); + $this->setIfExists('views', $data ?? [], null); + $this->setIfExists('plays', $data ?? [], null); + $this->setIfExists('collections', $data ?? [], null); + $this->setIfExists('me', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['title'] === null) { + $invalidProperties[] = "'title' can't be null"; + } + if ($this->container['privacy'] === null) { + $invalidProperties[] = "'privacy' can't be null"; + } + if ($this->container['user'] === null) { + $invalidProperties[] = "'user' can't be null"; + } + if ($this->container['html_url'] === null) { + $invalidProperties[] = "'html_url' can't be null"; + } + if ($this->container['edit_html_url'] === null) { + $invalidProperties[] = "'edit_html_url' can't be null"; + } + if ($this->container['collaborators'] === null) { + $invalidProperties[] = "'collaborators' can't be null"; + } + if ($this->container['creation_date'] === null) { + $invalidProperties[] = "'creation_date' can't be null"; + } + if ($this->container['instruments'] === null) { + $invalidProperties[] = "'instruments' can't be null"; + } + if ($this->container['instruments_names'] === null) { + $invalidProperties[] = "'instruments_names' can't be null"; + } + if ($this->container['samples'] === null) { + $invalidProperties[] = "'samples' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The unique identifier of the score + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sharing_key + * + * @return string|null + */ + public function getSharingKey(): ?string + { + return $this->container['sharing_key']; + } + + /** + * Sets sharing_key + * + * @param string|null $sharing_key The private sharing key of the score (available when the `privacy` mode is set to `privateLink`) + * + * @return $this + */ + public function setSharingKey(?string $sharing_key): static + { + if (is_null($sharing_key)) { + throw new InvalidArgumentException('non-nullable sharing_key cannot be null'); + } + $this->container['sharing_key'] = $sharing_key; + + return $this; + } + + /** + * Gets title + * + * @return string + */ + public function getTitle(): string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string $title The title of the score + * + * @return $this + */ + public function setTitle(string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets privacy + * + * @return \Flat\APIClient\Model\ScorePrivacy + */ + public function getPrivacy(): \Flat\APIClient\Model\ScorePrivacy + { + return $this->container['privacy']; + } + + /** + * Sets privacy + * + * @param \Flat\APIClient\Model\ScorePrivacy $privacy privacy + * + * @return $this + */ + public function setPrivacy(\Flat\APIClient\Model\ScorePrivacy $privacy): static + { + if (is_null($privacy)) { + throw new InvalidArgumentException('non-nullable privacy cannot be null'); + } + $this->container['privacy'] = $privacy; + + return $this; + } + + /** + * Gets user + * + * @return \Flat\APIClient\Model\UserPublic + */ + public function getUser(): \Flat\APIClient\Model\UserPublic + { + return $this->container['user']; + } + + /** + * Sets user + * + * @param \Flat\APIClient\Model\UserPublic $user user + * + * @return $this + */ + public function setUser(\Flat\APIClient\Model\UserPublic $user): static + { + if (is_null($user)) { + throw new InvalidArgumentException('non-nullable user cannot be null'); + } + $this->container['user'] = $user; + + return $this; + } + + /** + * Gets html_url + * + * @return string + */ + public function getHtmlUrl(): string + { + return $this->container['html_url']; + } + + /** + * Sets html_url + * + * @param string $html_url The url where the score can be viewed in a web browser + * + * @return $this + */ + public function setHtmlUrl(string $html_url): static + { + if (is_null($html_url)) { + throw new InvalidArgumentException('non-nullable html_url cannot be null'); + } + $this->container['html_url'] = $html_url; + + return $this; + } + + /** + * Gets edit_html_url + * + * @return string + */ + public function getEditHtmlUrl(): string + { + return $this->container['edit_html_url']; + } + + /** + * Sets edit_html_url + * + * @param string $edit_html_url The url where the score can be edited in a web browser + * + * @return $this + */ + public function setEditHtmlUrl(string $edit_html_url): static + { + if (is_null($edit_html_url)) { + throw new InvalidArgumentException('non-nullable edit_html_url cannot be null'); + } + $this->container['edit_html_url'] = $edit_html_url; + + return $this; + } + + /** + * Gets subtitle + * + * @return string|null + */ + public function getSubtitle(): ?string + { + return $this->container['subtitle']; + } + + /** + * Sets subtitle + * + * @param string|null $subtitle Subtitle of the score + * + * @return $this + */ + public function setSubtitle(?string $subtitle): static + { + if (is_null($subtitle)) { + throw new InvalidArgumentException('non-nullable subtitle cannot be null'); + } + $this->container['subtitle'] = $subtitle; + + return $this; + } + + /** + * Gets lyricist + * + * @return string|null + */ + public function getLyricist(): ?string + { + return $this->container['lyricist']; + } + + /** + * Sets lyricist + * + * @param string|null $lyricist Lyricist of the score + * + * @return $this + */ + public function setLyricist(?string $lyricist): static + { + if (is_null($lyricist)) { + throw new InvalidArgumentException('non-nullable lyricist cannot be null'); + } + $this->container['lyricist'] = $lyricist; + + return $this; + } + + /** + * Gets arranger + * + * @return string|null + */ + public function getArranger(): ?string + { + return $this->container['arranger']; + } + + /** + * Sets arranger + * + * @param string|null $arranger Arranger of the score + * + * @return $this + */ + public function setArranger(?string $arranger): static + { + if (is_null($arranger)) { + throw new InvalidArgumentException('non-nullable arranger cannot be null'); + } + $this->container['arranger'] = $arranger; + + return $this; + } + + /** + * Gets composer + * + * @return string|null + */ + public function getComposer(): ?string + { + return $this->container['composer']; + } + + /** + * Sets composer + * + * @param string|null $composer Composer of the score + * + * @return $this + */ + public function setComposer(?string $composer): static + { + if (is_null($composer)) { + throw new InvalidArgumentException('non-nullable composer cannot be null'); + } + $this->container['composer'] = $composer; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Description of the creation + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets tags + * + * @return string[]|null + */ + public function getTags(): ?array + { + return $this->container['tags']; + } + + /** + * Sets tags + * + * @param string[]|null $tags Tags describing the score + * + * @return $this + */ + public function setTags(?array $tags): static + { + if (is_null($tags)) { + throw new InvalidArgumentException('non-nullable tags cannot be null'); + } + $this->container['tags'] = $tags; + + return $this; + } + + /** + * Gets creation_type + * + * @return \Flat\APIClient\Model\ScoreCreationType|null + */ + public function getCreationType(): ?\Flat\APIClient\Model\ScoreCreationType + { + return $this->container['creation_type']; + } + + /** + * Sets creation_type + * + * @param \Flat\APIClient\Model\ScoreCreationType|null $creation_type creation_type + * + * @return $this + */ + public function setCreationType(?\Flat\APIClient\Model\ScoreCreationType $creation_type): static + { + if (is_null($creation_type)) { + array_push($this->openAPINullablesSetToNull, 'creation_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('creation_type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['creation_type'] = $creation_type; + + return $this; + } + + /** + * Gets license + * + * @return \Flat\APIClient\Model\ScoreLicense|null + */ + public function getLicense(): ?\Flat\APIClient\Model\ScoreLicense + { + return $this->container['license']; + } + + /** + * Sets license + * + * @param \Flat\APIClient\Model\ScoreLicense|null $license license + * + * @return $this + */ + public function setLicense(?\Flat\APIClient\Model\ScoreLicense $license): static + { + if (is_null($license)) { + array_push($this->openAPINullablesSetToNull, 'license'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('license', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['license'] = $license; + + return $this; + } + + /** + * Gets license_text + * + * @return string|null + */ + public function getLicenseText(): ?string + { + return $this->container['license_text']; + } + + /** + * Sets license_text + * + * @param string|null $license_text Additional license text written on the exported/printed score + * + * @return $this + */ + public function setLicenseText(?string $license_text): static + { + if (is_null($license_text)) { + throw new InvalidArgumentException('non-nullable license_text cannot be null'); + } + $this->container['license_text'] = $license_text; + + return $this; + } + + /** + * Gets duration_time + * + * @return float|null + */ + public function getDurationTime(): ?float + { + return $this->container['duration_time']; + } + + /** + * Sets duration_time + * + * @param float|null $duration_time In seconds, an approximative duration of the score + * + * @return $this + */ + public function setDurationTime(?float $duration_time): static + { + if (is_null($duration_time)) { + throw new InvalidArgumentException('non-nullable duration_time cannot be null'); + } + $this->container['duration_time'] = $duration_time; + + return $this; + } + + /** + * Gets number_measures + * + * @return int|null + */ + public function getNumberMeasures(): ?int + { + return $this->container['number_measures']; + } + + /** + * Sets number_measures + * + * @param int|null $number_measures The number of measures in the score + * + * @return $this + */ + public function setNumberMeasures(?int $number_measures): static + { + if (is_null($number_measures)) { + throw new InvalidArgumentException('non-nullable number_measures cannot be null'); + } + $this->container['number_measures'] = $number_measures; + + return $this; + } + + /** + * Gets main_tempo_qpm + * + * @return float|null + */ + public function getMainTempoQpm(): ?float + { + return $this->container['main_tempo_qpm']; + } + + /** + * Sets main_tempo_qpm + * + * @param float|null $main_tempo_qpm The main tempo of the score (in QPM) + * + * @return $this + */ + public function setMainTempoQpm(?float $main_tempo_qpm): static + { + if (is_null($main_tempo_qpm)) { + throw new InvalidArgumentException('non-nullable main_tempo_qpm cannot be null'); + } + $this->container['main_tempo_qpm'] = $main_tempo_qpm; + + return $this; + } + + /** + * Gets main_key_signature + * + * @return float|null + */ + public function getMainKeySignature(): ?float + { + return $this->container['main_key_signature']; + } + + /** + * Sets main_key_signature + * + * @param float|null $main_key_signature The main key signature of the score (expressed between -7 and 7). + * + * @return $this + */ + public function setMainKeySignature(?float $main_key_signature): static + { + if (is_null($main_key_signature)) { + throw new InvalidArgumentException('non-nullable main_key_signature cannot be null'); + } + $this->container['main_key_signature'] = $main_key_signature; + + return $this; + } + + /** + * Gets rights + * + * @return \Flat\APIClient\Model\ResourceRights|null + */ + public function getRights(): ?\Flat\APIClient\Model\ResourceRights + { + return $this->container['rights']; + } + + /** + * Sets rights + * + * @param \Flat\APIClient\Model\ResourceRights|null $rights rights + * + * @return $this + */ + public function setRights(?\Flat\APIClient\Model\ResourceRights $rights): static + { + if (is_null($rights)) { + throw new InvalidArgumentException('non-nullable rights cannot be null'); + } + $this->container['rights'] = $rights; + + return $this; + } + + /** + * Gets collaborators + * + * @return \Flat\APIClient\Model\ResourceCollaborator[] + */ + public function getCollaborators(): array + { + return $this->container['collaborators']; + } + + /** + * Sets collaborators + * + * @param \Flat\APIClient\Model\ResourceCollaborator[] $collaborators The list of the collaborators of the score + * + * @return $this + */ + public function setCollaborators(array $collaborators): static + { + if (is_null($collaborators)) { + throw new InvalidArgumentException('non-nullable collaborators cannot be null'); + } + $this->container['collaborators'] = $collaborators; + + return $this; + } + + /** + * Gets creation_date + * + * @return \DateTime + */ + public function getCreationDate(): \DateTime + { + return $this->container['creation_date']; + } + + /** + * Sets creation_date + * + * @param \DateTime $creation_date The date when the score was created + * + * @return $this + */ + public function setCreationDate(\DateTime $creation_date): static + { + if (is_null($creation_date)) { + throw new InvalidArgumentException('non-nullable creation_date cannot be null'); + } + $this->container['creation_date'] = $creation_date; + + return $this; + } + + /** + * Gets modification_date + * + * @return \DateTime|null + */ + public function getModificationDate(): ?\DateTime + { + return $this->container['modification_date']; + } + + /** + * Sets modification_date + * + * @param \DateTime|null $modification_date The date of the last revision of the score + * + * @return $this + */ + public function setModificationDate(?\DateTime $modification_date): static + { + if (is_null($modification_date)) { + throw new InvalidArgumentException('non-nullable modification_date cannot be null'); + } + $this->container['modification_date'] = $modification_date; + + return $this; + } + + /** + * Gets publication_date + * + * @return \DateTime|null + */ + public function getPublicationDate(): ?\DateTime + { + return $this->container['publication_date']; + } + + /** + * Sets publication_date + * + * @param \DateTime|null $publication_date The date when the score was published on Flat + * + * @return $this + */ + public function setPublicationDate(?\DateTime $publication_date): static + { + if (is_null($publication_date)) { + throw new InvalidArgumentException('non-nullable publication_date cannot be null'); + } + $this->container['publication_date'] = $publication_date; + + return $this; + } + + /** + * Gets scheduled_deletion_date + * + * @return \DateTime|null + */ + public function getScheduledDeletionDate(): ?\DateTime + { + return $this->container['scheduled_deletion_date']; + } + + /** + * Sets scheduled_deletion_date + * + * @param \DateTime|null $scheduled_deletion_date The date when the score will be definitively deleted. This date can be in the past if the score will be deleted at the next deletion batch, in this case you can display something like \"Deleted shortly\". Schedule: * For all paying users, the scores will be definitively deleted after 90 days. * For free users, the scores are no longer available after 24 hours, an can be restored with a paying account up to 90 days. + * + * @return $this + */ + public function setScheduledDeletionDate(?\DateTime $scheduled_deletion_date): static + { + if (is_null($scheduled_deletion_date)) { + throw new InvalidArgumentException('non-nullable scheduled_deletion_date cannot be null'); + } + $this->container['scheduled_deletion_date'] = $scheduled_deletion_date; + + return $this; + } + + /** + * Gets highlighted_date + * + * @return \DateTime|null + */ + public function getHighlightedDate(): ?\DateTime + { + return $this->container['highlighted_date']; + } + + /** + * Sets highlighted_date + * + * @param \DateTime|null $highlighted_date The date when the score was highlighted (featured) on our community + * + * @return $this + */ + public function setHighlightedDate(?\DateTime $highlighted_date): static + { + if (is_null($highlighted_date)) { + throw new InvalidArgumentException('non-nullable highlighted_date cannot be null'); + } + $this->container['highlighted_date'] = $highlighted_date; + + return $this; + } + + /** + * Gets organization + * + * @return string|null + */ + public function getOrganization(): ?string + { + return $this->container['organization']; + } + + /** + * Sets organization + * + * @param string|null $organization If the score has been created in an organization, the identifier of this organization. This property is especially used with the score privacy `organizationPublic`. + * + * @return $this + */ + public function setOrganization(?string $organization): static + { + if (is_null($organization)) { + throw new InvalidArgumentException('non-nullable organization cannot be null'); + } + $this->container['organization'] = $organization; + + return $this; + } + + /** + * Gets parent_score + * + * @return string|null + */ + public function getParentScore(): ?string + { + return $this->container['parent_score']; + } + + /** + * Sets parent_score + * + * @param string|null $parent_score If the score has been forked, the unique identifier of the parent score. + * + * @return $this + */ + public function setParentScore(?string $parent_score): static + { + if (is_null($parent_score)) { + throw new InvalidArgumentException('non-nullable parent_score cannot be null'); + } + $this->container['parent_score'] = $parent_score; + + return $this; + } + + /** + * Gets instruments + * + * @return string[] + */ + public function getInstruments(): array + { + return $this->container['instruments']; + } + + /** + * Sets instruments + * + * @param string[] $instruments An array of the instrument identifiers used in the last version of the score. This is mainly used to display a list of the instruments in the Flat's UI or instruments icons. The format of the strings is `{instrument-group}.{instrument-id}`. + * + * @return $this + */ + public function setInstruments(array $instruments): static + { + if (is_null($instruments)) { + throw new InvalidArgumentException('non-nullable instruments cannot be null'); + } + $this->container['instruments'] = $instruments; + + return $this; + } + + /** + * Gets instruments_names + * + * @return string[] + */ + public function getInstrumentsNames(): array + { + return $this->container['instruments_names']; + } + + /** + * Sets instruments_names + * + * @param string[] $instruments_names An array of the instrument names used in the last version of the score. This list is localized and ready-to-display and will match the indexes from the `instruments` list. + * + * @return $this + */ + public function setInstrumentsNames(array $instruments_names): static + { + if (is_null($instruments_names)) { + throw new InvalidArgumentException('non-nullable instruments_names cannot be null'); + } + $this->container['instruments_names'] = $instruments_names; + + return $this; + } + + /** + * Gets samples + * + * @return string[] + */ + public function getSamples(): array + { + return $this->container['samples']; + } + + /** + * Sets samples + * + * @param string[] $samples An array of the audio samples identifiers used the different score parts. The format of the strings is `{instrument-group}.{sample-id}`. + * + * @return $this + */ + public function setSamples(array $samples): static + { + if (is_null($samples)) { + throw new InvalidArgumentException('non-nullable samples cannot be null'); + } + $this->container['samples'] = $samples; + + return $this; + } + + /** + * Gets google_drive_file_id + * + * @return string|null + */ + public function getGoogleDriveFileId(): ?string + { + return $this->container['google_drive_file_id']; + } + + /** + * Sets google_drive_file_id + * + * @param string|null $google_drive_file_id If the user uses Google Drive and the score exists on Google Drive, this field will contain the unique identifier of the Flat score on Google Drive. You can access the document using the url: `https://drive.google.com/open?id={googleDriveFileId}` + * + * @return $this + */ + public function setGoogleDriveFileId(?string $google_drive_file_id): static + { + if (is_null($google_drive_file_id)) { + throw new InvalidArgumentException('non-nullable google_drive_file_id cannot be null'); + } + $this->container['google_drive_file_id'] = $google_drive_file_id; + + return $this; + } + + /** + * Gets likes + * + * @return \Flat\APIClient\Model\ScoreLikesCounts|null + */ + public function getLikes(): ?\Flat\APIClient\Model\ScoreLikesCounts + { + return $this->container['likes']; + } + + /** + * Sets likes + * + * @param \Flat\APIClient\Model\ScoreLikesCounts|null $likes likes + * + * @return $this + */ + public function setLikes(?\Flat\APIClient\Model\ScoreLikesCounts $likes): static + { + if (is_null($likes)) { + throw new InvalidArgumentException('non-nullable likes cannot be null'); + } + $this->container['likes'] = $likes; + + return $this; + } + + /** + * Gets comments + * + * @return \Flat\APIClient\Model\ScoreCommentsCounts|null + */ + public function getComments(): ?\Flat\APIClient\Model\ScoreCommentsCounts + { + return $this->container['comments']; + } + + /** + * Sets comments + * + * @param \Flat\APIClient\Model\ScoreCommentsCounts|null $comments comments + * + * @return $this + */ + public function setComments(?\Flat\APIClient\Model\ScoreCommentsCounts $comments): static + { + if (is_null($comments)) { + throw new InvalidArgumentException('non-nullable comments cannot be null'); + } + $this->container['comments'] = $comments; + + return $this; + } + + /** + * Gets views + * + * @return \Flat\APIClient\Model\ScoreViewsCounts|null + */ + public function getViews(): ?\Flat\APIClient\Model\ScoreViewsCounts + { + return $this->container['views']; + } + + /** + * Sets views + * + * @param \Flat\APIClient\Model\ScoreViewsCounts|null $views views + * + * @return $this + */ + public function setViews(?\Flat\APIClient\Model\ScoreViewsCounts $views): static + { + if (is_null($views)) { + throw new InvalidArgumentException('non-nullable views cannot be null'); + } + $this->container['views'] = $views; + + return $this; + } + + /** + * Gets plays + * + * @return \Flat\APIClient\Model\ScorePlaysCounts|null + */ + public function getPlays(): ?\Flat\APIClient\Model\ScorePlaysCounts + { + return $this->container['plays']; + } + + /** + * Sets plays + * + * @param \Flat\APIClient\Model\ScorePlaysCounts|null $plays plays + * + * @return $this + */ + public function setPlays(?\Flat\APIClient\Model\ScorePlaysCounts $plays): static + { + if (is_null($plays)) { + throw new InvalidArgumentException('non-nullable plays cannot be null'); + } + $this->container['plays'] = $plays; + + return $this; + } + + /** + * Gets collections + * + * @return string[]|null + */ + public function getCollections(): ?array + { + return $this->container['collections']; + } + + /** + * Sets collections + * + * @param string[]|null $collections The List of parent collections, which includes all the collections this score is included. Please note that you might not have access to all of them. + * + * @return $this + */ + public function setCollections(?array $collections): static + { + if (is_null($collections)) { + throw new InvalidArgumentException('non-nullable collections cannot be null'); + } + $this->container['collections'] = $collections; + + return $this; + } + + /** + * Gets me + * + * @return \Flat\APIClient\Model\ScoreDetailsAllOfMe|null + */ + public function getMe(): ?\Flat\APIClient\Model\ScoreDetailsAllOfMe + { + return $this->container['me']; + } + + /** + * Sets me + * + * @param \Flat\APIClient\Model\ScoreDetailsAllOfMe|null $me me + * + * @return $this + */ + public function setMe(?\Flat\APIClient\Model\ScoreDetailsAllOfMe $me): static + { + if (is_null($me)) { + throw new InvalidArgumentException('non-nullable me cannot be null'); + } + $this->container['me'] = $me; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreDetailsAllOfMe.php b/src/Model/ScoreDetailsAllOfMe.php new file mode 100644 index 0000000..70ef5a4 --- /dev/null +++ b/src/Model/ScoreDetailsAllOfMe.php @@ -0,0 +1,425 @@ + + */ +class ScoreDetailsAllOfMe implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreDetails_allOf_me'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'is_liked' => 'bool', + 'is_in_library' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'is_liked' => null, + 'is_in_library' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'is_liked' => false, + 'is_in_library' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'is_liked' => 'isLiked', + 'is_in_library' => 'isInLibrary' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'is_liked' => 'setIsLiked', + 'is_in_library' => 'setIsInLibrary' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'is_liked' => 'getIsLiked', + 'is_in_library' => 'getIsInLibrary' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('is_liked', $data ?? [], null); + $this->setIfExists('is_in_library', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['is_liked'] === null) { + $invalidProperties[] = "'is_liked' can't be null"; + } + if ($this->container['is_in_library'] === null) { + $invalidProperties[] = "'is_in_library' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets is_liked + * + * @return bool + */ + public function getIsLiked(): bool + { + return $this->container['is_liked']; + } + + /** + * Sets is_liked + * + * @param bool $is_liked True if the current user likes this score + * + * @return $this + */ + public function setIsLiked(bool $is_liked): static + { + if (is_null($is_liked)) { + throw new InvalidArgumentException('non-nullable is_liked cannot be null'); + } + $this->container['is_liked'] = $is_liked; + + return $this; + } + + /** + * Gets is_in_library + * + * @return bool + */ + public function getIsInLibrary(): bool + { + return $this->container['is_in_library']; + } + + /** + * Sets is_in_library + * + * @param bool $is_in_library True if the score is stored in one of the user's collections + * + * @return $this + */ + public function setIsInLibrary(bool $is_in_library): static + { + if (is_null($is_in_library)) { + throw new InvalidArgumentException('non-nullable is_in_library cannot be null'); + } + $this->container['is_in_library'] = $is_in_library; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreFork.php b/src/Model/ScoreFork.php new file mode 100644 index 0000000..7dfc3a2 --- /dev/null +++ b/src/Model/ScoreFork.php @@ -0,0 +1,460 @@ + + */ +class ScoreFork implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreFork'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'collection' => 'string', + 'google_drive_disabled' => 'bool', + 'keep_original_title' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'collection' => null, + 'google_drive_disabled' => null, + 'keep_original_title' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'collection' => true, + 'google_drive_disabled' => false, + 'keep_original_title' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'collection' => 'collection', + 'google_drive_disabled' => 'googleDriveDisabled', + 'keep_original_title' => 'keepOriginalTitle' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'collection' => 'setCollection', + 'google_drive_disabled' => 'setGoogleDriveDisabled', + 'keep_original_title' => 'setKeepOriginalTitle' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'collection' => 'getCollection', + 'google_drive_disabled' => 'getGoogleDriveDisabled', + 'keep_original_title' => 'getKeepOriginalTitle' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('collection', $data ?? [], null); + $this->setIfExists('google_drive_disabled', $data ?? [], false); + $this->setIfExists('keep_original_title', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets collection + * + * @return string|null + */ + public function getCollection(): ?string + { + return $this->container['collection']; + } + + /** + * Sets collection + * + * @param string|null $collection Unique identifier of a collection where the score will be copied. If no collection identifier is provided, a virtual collection is used, or `null` is provided, the score won't be added to any collection and will only be visible in the `allScores` virtual collection. + * + * @return $this + */ + public function setCollection(?string $collection): static + { + if (is_null($collection)) { + array_push($this->openAPINullablesSetToNull, 'collection'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('collection', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['collection'] = $collection; + + return $this; + } + + /** + * Gets google_drive_disabled + * + * @return bool|null + */ + public function getGoogleDriveDisabled(): ?bool + { + return $this->container['google_drive_disabled']; + } + + /** + * Sets google_drive_disabled + * + * @param bool|null $google_drive_disabled If set to `true`, the API won't create the score on Google Drive + * + * @return $this + */ + public function setGoogleDriveDisabled(?bool $google_drive_disabled): static + { + if (is_null($google_drive_disabled)) { + throw new InvalidArgumentException('non-nullable google_drive_disabled cannot be null'); + } + $this->container['google_drive_disabled'] = $google_drive_disabled; + + return $this; + } + + /** + * Gets keep_original_title + * + * @return bool|null + */ + public function getKeepOriginalTitle(): ?bool + { + return $this->container['keep_original_title']; + } + + /** + * Sets keep_original_title + * + * @param bool|null $keep_original_title Option to keep the original title of the score (i.e. don't prepend it with \"Copy of \", or add the student name in assignment usage). + * + * @return $this + */ + public function setKeepOriginalTitle(?bool $keep_original_title): static + { + if (is_null($keep_original_title)) { + throw new InvalidArgumentException('non-nullable keep_original_title cannot be null'); + } + $this->container['keep_original_title'] = $keep_original_title; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreLicense.php b/src/Model/ScoreLicense.php new file mode 100644 index 0000000..e9acc93 --- /dev/null +++ b/src/Model/ScoreLicense.php @@ -0,0 +1,58 @@ + + */ +class ScoreLikesCounts implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreLikesCounts'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'total' => 'float', + 'weekly' => 'float', + 'monthly' => 'float', + 'yearly' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'total' => null, + 'weekly' => null, + 'monthly' => null, + 'yearly' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'total' => false, + 'weekly' => false, + 'monthly' => false, + 'yearly' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'total' => 'total', + 'weekly' => 'weekly', + 'monthly' => 'monthly', + 'yearly' => 'yearly' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'total' => 'setTotal', + 'weekly' => 'setWeekly', + 'monthly' => 'setMonthly', + 'yearly' => 'setYearly' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'total' => 'getTotal', + 'weekly' => 'getWeekly', + 'monthly' => 'getMonthly', + 'yearly' => 'getYearly' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('weekly', $data ?? [], null); + $this->setIfExists('monthly', $data ?? [], null); + $this->setIfExists('yearly', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets total + * + * @return float|null + */ + public function getTotal(): ?float + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param float|null $total The total number of likes of the score + * + * @return $this + */ + public function setTotal(?float $total): static + { + if (is_null($total)) { + throw new InvalidArgumentException('non-nullable total cannot be null'); + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets weekly + * + * @return float|null + */ + public function getWeekly(): ?float + { + return $this->container['weekly']; + } + + /** + * Sets weekly + * + * @param float|null $weekly The number of new likes during the last week + * + * @return $this + */ + public function setWeekly(?float $weekly): static + { + if (is_null($weekly)) { + throw new InvalidArgumentException('non-nullable weekly cannot be null'); + } + $this->container['weekly'] = $weekly; + + return $this; + } + + /** + * Gets monthly + * + * @return float|null + */ + public function getMonthly(): ?float + { + return $this->container['monthly']; + } + + /** + * Sets monthly + * + * @param float|null $monthly The number of new likes during the last month + * + * @return $this + */ + public function setMonthly(?float $monthly): static + { + if (is_null($monthly)) { + throw new InvalidArgumentException('non-nullable monthly cannot be null'); + } + $this->container['monthly'] = $monthly; + + return $this; + } + + /** + * Gets yearly + * + * @return float|null + */ + public function getYearly(): ?float + { + return $this->container['yearly']; + } + + /** + * Sets yearly + * + * @param float|null $yearly The number of new likes during the last year + * + * @return $this + */ + public function setYearly(?float $yearly): static + { + if (is_null($yearly)) { + throw new InvalidArgumentException('non-nullable yearly cannot be null'); + } + $this->container['yearly'] = $yearly; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreModification.php b/src/Model/ScoreModification.php new file mode 100644 index 0000000..b6a827b --- /dev/null +++ b/src/Model/ScoreModification.php @@ -0,0 +1,832 @@ + + */ +class ScoreModification implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreModification'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'title' => 'string', + 'subtitle' => 'string', + 'composer' => 'string', + 'lyricist' => 'string', + 'arranger' => 'string', + 'privacy' => '\Flat\APIClient\Model\ScorePrivacy', + 'sharing_key' => 'string', + 'description' => 'string', + 'tags' => 'string[]', + 'creation_type' => '\Flat\APIClient\Model\ScoreCreationType', + 'license' => '\Flat\APIClient\Model\ScoreLicense', + 'license_text' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'title' => null, + 'subtitle' => null, + 'composer' => null, + 'lyricist' => null, + 'arranger' => null, + 'privacy' => null, + 'sharing_key' => null, + 'description' => null, + 'tags' => null, + 'creation_type' => null, + 'license' => null, + 'license_text' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'title' => false, + 'subtitle' => true, + 'composer' => true, + 'lyricist' => true, + 'arranger' => true, + 'privacy' => false, + 'sharing_key' => false, + 'description' => true, + 'tags' => false, + 'creation_type' => true, + 'license' => true, + 'license_text' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'title' => 'title', + 'subtitle' => 'subtitle', + 'composer' => 'composer', + 'lyricist' => 'lyricist', + 'arranger' => 'arranger', + 'privacy' => 'privacy', + 'sharing_key' => 'sharingKey', + 'description' => 'description', + 'tags' => 'tags', + 'creation_type' => 'creationType', + 'license' => 'license', + 'license_text' => 'licenseText' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'title' => 'setTitle', + 'subtitle' => 'setSubtitle', + 'composer' => 'setComposer', + 'lyricist' => 'setLyricist', + 'arranger' => 'setArranger', + 'privacy' => 'setPrivacy', + 'sharing_key' => 'setSharingKey', + 'description' => 'setDescription', + 'tags' => 'setTags', + 'creation_type' => 'setCreationType', + 'license' => 'setLicense', + 'license_text' => 'setLicenseText' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'title' => 'getTitle', + 'subtitle' => 'getSubtitle', + 'composer' => 'getComposer', + 'lyricist' => 'getLyricist', + 'arranger' => 'getArranger', + 'privacy' => 'getPrivacy', + 'sharing_key' => 'getSharingKey', + 'description' => 'getDescription', + 'tags' => 'getTags', + 'creation_type' => 'getCreationType', + 'license' => 'getLicense', + 'license_text' => 'getLicenseText' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('subtitle', $data ?? [], null); + $this->setIfExists('composer', $data ?? [], null); + $this->setIfExists('lyricist', $data ?? [], null); + $this->setIfExists('arranger', $data ?? [], null); + $this->setIfExists('privacy', $data ?? [], null); + $this->setIfExists('sharing_key', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('tags', $data ?? [], null); + $this->setIfExists('creation_type', $data ?? [], null); + $this->setIfExists('license', $data ?? [], null); + $this->setIfExists('license_text', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['sharing_key']) && !preg_match("/^[a-f0-9]{128}$/", $this->container['sharing_key'])) { + $invalidProperties[] = "invalid value for 'sharing_key', must be conform to the pattern /^[a-f0-9]{128}$/."; + } + + if (!is_null($this->container['description']) && (mb_strlen($this->container['description']) > 2000)) { + $invalidProperties[] = "invalid value for 'description', the character length must be smaller than or equal to 2000."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets title + * + * @return string|null + */ + public function getTitle(): ?string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the score + * + * @return $this + */ + public function setTitle(?string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets subtitle + * + * @return string|null + */ + public function getSubtitle(): ?string + { + return $this->container['subtitle']; + } + + /** + * Sets subtitle + * + * @param string|null $subtitle The subtitle of the score + * + * @return $this + */ + public function setSubtitle(?string $subtitle): static + { + if (is_null($subtitle)) { + array_push($this->openAPINullablesSetToNull, 'subtitle'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subtitle', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['subtitle'] = $subtitle; + + return $this; + } + + /** + * Gets composer + * + * @return string|null + */ + public function getComposer(): ?string + { + return $this->container['composer']; + } + + /** + * Sets composer + * + * @param string|null $composer The composer of the score + * + * @return $this + */ + public function setComposer(?string $composer): static + { + if (is_null($composer)) { + array_push($this->openAPINullablesSetToNull, 'composer'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('composer', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['composer'] = $composer; + + return $this; + } + + /** + * Gets lyricist + * + * @return string|null + */ + public function getLyricist(): ?string + { + return $this->container['lyricist']; + } + + /** + * Sets lyricist + * + * @param string|null $lyricist The lyricist of the score + * + * @return $this + */ + public function setLyricist(?string $lyricist): static + { + if (is_null($lyricist)) { + array_push($this->openAPINullablesSetToNull, 'lyricist'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('lyricist', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['lyricist'] = $lyricist; + + return $this; + } + + /** + * Gets arranger + * + * @return string|null + */ + public function getArranger(): ?string + { + return $this->container['arranger']; + } + + /** + * Sets arranger + * + * @param string|null $arranger The arranger of the score + * + * @return $this + */ + public function setArranger(?string $arranger): static + { + if (is_null($arranger)) { + array_push($this->openAPINullablesSetToNull, 'arranger'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('arranger', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['arranger'] = $arranger; + + return $this; + } + + /** + * Gets privacy + * + * @return \Flat\APIClient\Model\ScorePrivacy|null + */ + public function getPrivacy(): ?\Flat\APIClient\Model\ScorePrivacy + { + return $this->container['privacy']; + } + + /** + * Sets privacy + * + * @param \Flat\APIClient\Model\ScorePrivacy|null $privacy privacy + * + * @return $this + */ + public function setPrivacy(?\Flat\APIClient\Model\ScorePrivacy $privacy): static + { + if (is_null($privacy)) { + throw new InvalidArgumentException('non-nullable privacy cannot be null'); + } + $this->container['privacy'] = $privacy; + + return $this; + } + + /** + * Gets sharing_key + * + * @return string|null + */ + public function getSharingKey(): ?string + { + return $this->container['sharing_key']; + } + + /** + * Sets sharing_key + * + * @param string|null $sharing_key When using the `privacy` mode `privateLink`, this property can be used to set a custom sharing key, otherwise a new key will be generated. + * + * @return $this + */ + public function setSharingKey(?string $sharing_key): static + { + if (is_null($sharing_key)) { + throw new InvalidArgumentException('non-nullable sharing_key cannot be null'); + } + + if ((!preg_match("/^[a-f0-9]{128}$/", ObjectSerializer::toString($sharing_key)))) { + throw new InvalidArgumentException("invalid value for \$sharing_key when calling ScoreModification., must conform to the pattern /^[a-f0-9]{128}$/."); + } + + $this->container['sharing_key'] = $sharing_key; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Description of the creation + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($description) && (mb_strlen($description) > 2000)) { + throw new InvalidArgumentException('invalid length for $description when calling ScoreModification., must be smaller than or equal to 2000.'); + } + + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets tags + * + * @return string[]|null + */ + public function getTags(): ?array + { + return $this->container['tags']; + } + + /** + * Sets tags + * + * @param string[]|null $tags Tags describing the score + * + * @return $this + */ + public function setTags(?array $tags): static + { + if (is_null($tags)) { + throw new InvalidArgumentException('non-nullable tags cannot be null'); + } + $this->container['tags'] = $tags; + + return $this; + } + + /** + * Gets creation_type + * + * @return \Flat\APIClient\Model\ScoreCreationType|null + */ + public function getCreationType(): ?\Flat\APIClient\Model\ScoreCreationType + { + return $this->container['creation_type']; + } + + /** + * Sets creation_type + * + * @param \Flat\APIClient\Model\ScoreCreationType|null $creation_type creation_type + * + * @return $this + */ + public function setCreationType(?\Flat\APIClient\Model\ScoreCreationType $creation_type): static + { + if (is_null($creation_type)) { + array_push($this->openAPINullablesSetToNull, 'creation_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('creation_type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['creation_type'] = $creation_type; + + return $this; + } + + /** + * Gets license + * + * @return \Flat\APIClient\Model\ScoreLicense|null + */ + public function getLicense(): ?\Flat\APIClient\Model\ScoreLicense + { + return $this->container['license']; + } + + /** + * Sets license + * + * @param \Flat\APIClient\Model\ScoreLicense|null $license license + * + * @return $this + */ + public function setLicense(?\Flat\APIClient\Model\ScoreLicense $license): static + { + if (is_null($license)) { + array_push($this->openAPINullablesSetToNull, 'license'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('license', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['license'] = $license; + + return $this; + } + + /** + * Gets license_text + * + * @return string|null + */ + public function getLicenseText(): ?string + { + return $this->container['license_text']; + } + + /** + * Sets license_text + * + * @param string|null $license_text The rights info written on the score + * + * @return $this + */ + public function setLicenseText(?string $license_text): static + { + if (is_null($license_text)) { + array_push($this->openAPINullablesSetToNull, 'license_text'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('license_text', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['license_text'] = $license_text; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScorePlaysCounts.php b/src/Model/ScorePlaysCounts.php new file mode 100644 index 0000000..365cf7b --- /dev/null +++ b/src/Model/ScorePlaysCounts.php @@ -0,0 +1,487 @@ + + */ +class ScorePlaysCounts implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScorePlaysCounts'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'total' => 'float', + 'weekly' => 'float', + 'monthly' => 'float', + 'yearly' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'total' => null, + 'weekly' => null, + 'monthly' => null, + 'yearly' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'total' => false, + 'weekly' => false, + 'monthly' => false, + 'yearly' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'total' => 'total', + 'weekly' => 'weekly', + 'monthly' => 'monthly', + 'yearly' => 'yearly' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'total' => 'setTotal', + 'weekly' => 'setWeekly', + 'monthly' => 'setMonthly', + 'yearly' => 'setYearly' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'total' => 'getTotal', + 'weekly' => 'getWeekly', + 'monthly' => 'getMonthly', + 'yearly' => 'getYearly' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('weekly', $data ?? [], null); + $this->setIfExists('monthly', $data ?? [], null); + $this->setIfExists('yearly', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets total + * + * @return float|null + */ + public function getTotal(): ?float + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param float|null $total The total number of plays of the score + * + * @return $this + */ + public function setTotal(?float $total): static + { + if (is_null($total)) { + throw new InvalidArgumentException('non-nullable total cannot be null'); + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets weekly + * + * @return float|null + */ + public function getWeekly(): ?float + { + return $this->container['weekly']; + } + + /** + * Sets weekly + * + * @param float|null $weekly The weekly number of plays of the score + * + * @return $this + */ + public function setWeekly(?float $weekly): static + { + if (is_null($weekly)) { + throw new InvalidArgumentException('non-nullable weekly cannot be null'); + } + $this->container['weekly'] = $weekly; + + return $this; + } + + /** + * Gets monthly + * + * @return float|null + */ + public function getMonthly(): ?float + { + return $this->container['monthly']; + } + + /** + * Sets monthly + * + * @param float|null $monthly The monthly number of plays of the score + * + * @return $this + */ + public function setMonthly(?float $monthly): static + { + if (is_null($monthly)) { + throw new InvalidArgumentException('non-nullable monthly cannot be null'); + } + $this->container['monthly'] = $monthly; + + return $this; + } + + /** + * Gets yearly + * + * @return float|null + */ + public function getYearly(): ?float + { + return $this->container['yearly']; + } + + /** + * Sets yearly + * + * @param float|null $yearly The yearly number of plays of the score + * + * @return $this + */ + public function setYearly(?float $yearly): static + { + if (is_null($yearly)) { + throw new InvalidArgumentException('non-nullable yearly cannot be null'); + } + $this->container['yearly'] = $yearly; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScorePrivacy.php b/src/Model/ScorePrivacy.php new file mode 100644 index 0000000..3bfe9b8 --- /dev/null +++ b/src/Model/ScorePrivacy.php @@ -0,0 +1,50 @@ + + */ +class ScoreRevision implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreRevision'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'user' => 'string', + 'score' => 'string', + 'collaborators' => 'string[]', + 'date' => '\DateTime', + 'event' => 'string', + 'description' => 'string', + 'autosave' => 'bool', + 'statistics' => '\Flat\APIClient\Model\ScoreRevisionStatistics' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'user' => null, + 'score' => null, + 'collaborators' => null, + 'date' => 'date-time', + 'event' => null, + 'description' => null, + 'autosave' => null, + 'statistics' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user' => false, + 'score' => false, + 'collaborators' => false, + 'date' => false, + 'event' => false, + 'description' => false, + 'autosave' => false, + 'statistics' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'user' => 'user', + 'score' => 'score', + 'collaborators' => 'collaborators', + 'date' => 'date', + 'event' => 'event', + 'description' => 'description', + 'autosave' => 'autosave', + 'statistics' => 'statistics' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'user' => 'setUser', + 'score' => 'setScore', + 'collaborators' => 'setCollaborators', + 'date' => 'setDate', + 'event' => 'setEvent', + 'description' => 'setDescription', + 'autosave' => 'setAutosave', + 'statistics' => 'setStatistics' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'user' => 'getUser', + 'score' => 'getScore', + 'collaborators' => 'getCollaborators', + 'date' => 'getDate', + 'event' => 'getEvent', + 'description' => 'getDescription', + 'autosave' => 'getAutosave', + 'statistics' => 'getStatistics' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user', $data ?? [], null); + $this->setIfExists('score', $data ?? [], null); + $this->setIfExists('collaborators', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('event', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('autosave', $data ?? [], null); + $this->setIfExists('statistics', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['score'] === null) { + $invalidProperties[] = "'score' can't be null"; + } + if ($this->container['date'] === null) { + $invalidProperties[] = "'date' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The unique identifier of the revision. + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user + * + * @return string|null + */ + public function getUser(): ?string + { + return $this->container['user']; + } + + /** + * Sets user + * + * @param string|null $user The user identifier who created the revision + * + * @return $this + */ + public function setUser(?string $user): static + { + if (is_null($user)) { + throw new InvalidArgumentException('non-nullable user cannot be null'); + } + $this->container['user'] = $user; + + return $this; + } + + /** + * Gets score + * + * @return string + */ + public function getScore(): string + { + return $this->container['score']; + } + + /** + * Sets score + * + * @param string $score The score identifier + * + * @return $this + */ + public function setScore(string $score): static + { + if (is_null($score)) { + throw new InvalidArgumentException('non-nullable score cannot be null'); + } + $this->container['score'] = $score; + + return $this; + } + + /** + * Gets collaborators + * + * @return string[]|null + */ + public function getCollaborators(): ?array + { + return $this->container['collaborators']; + } + + /** + * Sets collaborators + * + * @param string[]|null $collaborators collaborators + * + * @return $this + */ + public function setCollaborators(?array $collaborators): static + { + if (is_null($collaborators)) { + throw new InvalidArgumentException('non-nullable collaborators cannot be null'); + } + $this->container['collaborators'] = $collaborators; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime + */ + public function getDate(): \DateTime + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime $date The date when this revision was created + * + * @return $this + */ + public function setDate(\DateTime $date): static + { + if (is_null($date)) { + throw new InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets event + * + * @return string|null + */ + public function getEvent(): ?string + { + return $this->container['event']; + } + + /** + * Sets event + * + * @param string|null $event The last event (action id) of the revision + * + * @return $this + */ + public function setEvent(?string $event): static + { + if (is_null($event)) { + throw new InvalidArgumentException('non-nullable event cannot be null'); + } + $this->container['event'] = $event; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description A description associated to the revision + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets autosave + * + * @return bool|null + */ + public function getAutosave(): ?bool + { + return $this->container['autosave']; + } + + /** + * Sets autosave + * + * @param bool|null $autosave True if this revision was automatically generated by Flat and not on purpose by the user. + * + * @return $this + */ + public function setAutosave(?bool $autosave): static + { + if (is_null($autosave)) { + throw new InvalidArgumentException('non-nullable autosave cannot be null'); + } + $this->container['autosave'] = $autosave; + + return $this; + } + + /** + * Gets statistics + * + * @return \Flat\APIClient\Model\ScoreRevisionStatistics|null + */ + public function getStatistics(): ?\Flat\APIClient\Model\ScoreRevisionStatistics + { + return $this->container['statistics']; + } + + /** + * Sets statistics + * + * @param \Flat\APIClient\Model\ScoreRevisionStatistics|null $statistics statistics + * + * @return $this + */ + public function setStatistics(?\Flat\APIClient\Model\ScoreRevisionStatistics $statistics): static + { + if (is_null($statistics)) { + throw new InvalidArgumentException('non-nullable statistics cannot be null'); + } + $this->container['statistics'] = $statistics; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreRevisionCreation.php b/src/Model/ScoreRevisionCreation.php new file mode 100644 index 0000000..d57c720 --- /dev/null +++ b/src/Model/ScoreRevisionCreation.php @@ -0,0 +1,522 @@ + + */ +class ScoreRevisionCreation implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreRevisionCreation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'data' => 'string', + 'data_encoding' => 'string', + 'autosave' => 'bool', + 'description' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'data' => null, + 'data_encoding' => null, + 'autosave' => null, + 'description' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'data' => false, + 'data_encoding' => false, + 'autosave' => false, + 'description' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'data' => 'data', + 'data_encoding' => 'dataEncoding', + 'autosave' => 'autosave', + 'description' => 'description' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'data' => 'setData', + 'data_encoding' => 'setDataEncoding', + 'autosave' => 'setAutosave', + 'description' => 'setDescription' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'data' => 'getData', + 'data_encoding' => 'getDataEncoding', + 'autosave' => 'getAutosave', + 'description' => 'getDescription' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const DATA_ENCODING_BASE64 = 'base64'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getDataEncodingAllowableValues() + { + return [ + self::DATA_ENCODING_BASE64, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('data_encoding', $data ?? [], null); + $this->setIfExists('autosave', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + $allowedValues = self::getDataEncodingAllowableValues(); + if (!is_null($this->container['data_encoding']) && !in_array($this->container['data_encoding'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'data_encoding', must be one of '%s'", + $this->container['data_encoding'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets data + * + * @return string + */ + public function getData(): string + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param string $data The data of the score file. It must be a MusicXML 3 file (`vnd.recordare.musicxml` or `vnd.recordare.musicxml+xml`), a MIDI file (`audio/midi`) or a Flat.json (aka Adagio.json) file. Binary payloads (`vnd.recordare.musicxml` and `audio/midi`) can be encoded in Base64, in this case the `dataEncoding` property must match the encoding used for the API request. + * + * @return $this + */ + public function setData(string $data): static + { + if (is_null($data)) { + throw new InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets data_encoding + * + * @return string|null + */ + public function getDataEncoding(): ?string + { + return $this->container['data_encoding']; + } + + /** + * Sets data_encoding + * + * @param string|null $data_encoding The optional encoding of the score data. This property must match the encoding used for the `data` property. + * + * @return $this + */ + public function setDataEncoding(?string $data_encoding): static + { + if (is_null($data_encoding)) { + throw new InvalidArgumentException('non-nullable data_encoding cannot be null'); + } + $allowedValues = self::getDataEncodingAllowableValues(); + if (!in_array($data_encoding, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'data_encoding', must be one of '%s'", + $data_encoding, + implode("', '", $allowedValues) + ) + ); + } + $this->container['data_encoding'] = $data_encoding; + + return $this; + } + + /** + * Gets autosave + * + * @return bool|null + */ + public function getAutosave(): ?bool + { + return $this->container['autosave']; + } + + /** + * Sets autosave + * + * @param bool|null $autosave Must be set to `true` if the revision was created automatically. + * + * @return $this + */ + public function setAutosave(?bool $autosave): static + { + if (is_null($autosave)) { + throw new InvalidArgumentException('non-nullable autosave cannot be null'); + } + $this->container['autosave'] = $autosave; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description A description associated to the revision + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreRevisionStatistics.php b/src/Model/ScoreRevisionStatistics.php new file mode 100644 index 0000000..981c97f --- /dev/null +++ b/src/Model/ScoreRevisionStatistics.php @@ -0,0 +1,487 @@ + + */ +class ScoreRevisionStatistics implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreRevisionStatistics'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'additions' => 'float', + 'deletions' => 'float', + 'start_date' => '\DateTime', + 'end_date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'additions' => null, + 'deletions' => null, + 'start_date' => 'date-time', + 'end_date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'additions' => false, + 'deletions' => false, + 'start_date' => false, + 'end_date' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'additions' => 'additions', + 'deletions' => 'deletions', + 'start_date' => 'startDate', + 'end_date' => 'endDate' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'additions' => 'setAdditions', + 'deletions' => 'setDeletions', + 'start_date' => 'setStartDate', + 'end_date' => 'setEndDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'additions' => 'getAdditions', + 'deletions' => 'getDeletions', + 'start_date' => 'getStartDate', + 'end_date' => 'getEndDate' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('additions', $data ?? [], null); + $this->setIfExists('deletions', $data ?? [], null); + $this->setIfExists('start_date', $data ?? [], null); + $this->setIfExists('end_date', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets additions + * + * @return float|null + */ + public function getAdditions(): ?float + { + return $this->container['additions']; + } + + /** + * Sets additions + * + * @param float|null $additions The number of additions operations in the last revision + * + * @return $this + */ + public function setAdditions(?float $additions): static + { + if (is_null($additions)) { + throw new InvalidArgumentException('non-nullable additions cannot be null'); + } + $this->container['additions'] = $additions; + + return $this; + } + + /** + * Gets deletions + * + * @return float|null + */ + public function getDeletions(): ?float + { + return $this->container['deletions']; + } + + /** + * Sets deletions + * + * @param float|null $deletions The number of deletions operations in the last revision + * + * @return $this + */ + public function setDeletions(?float $deletions): static + { + if (is_null($deletions)) { + throw new InvalidArgumentException('non-nullable deletions cannot be null'); + } + $this->container['deletions'] = $deletions; + + return $this; + } + + /** + * Gets start_date + * + * @return \DateTime|null + */ + public function getStartDate(): ?\DateTime + { + return $this->container['start_date']; + } + + /** + * Sets start_date + * + * @param \DateTime|null $start_date The date of the first action included in this revision + * + * @return $this + */ + public function setStartDate(?\DateTime $start_date): static + { + if (is_null($start_date)) { + throw new InvalidArgumentException('non-nullable start_date cannot be null'); + } + $this->container['start_date'] = $start_date; + + return $this; + } + + /** + * Gets end_date + * + * @return \DateTime|null + */ + public function getEndDate(): ?\DateTime + { + return $this->container['end_date']; + } + + /** + * Sets end_date + * + * @param \DateTime|null $end_date The date of the latest action included in this revision + * + * @return $this + */ + public function setEndDate(?\DateTime $end_date): static + { + if (is_null($end_date)) { + throw new InvalidArgumentException('non-nullable end_date cannot be null'); + } + $this->container['end_date'] = $end_date; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreSource.php b/src/Model/ScoreSource.php new file mode 100644 index 0000000..cc6d1a2 --- /dev/null +++ b/src/Model/ScoreSource.php @@ -0,0 +1,384 @@ + + */ +class ScoreSource implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreSource'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'google_drive' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'google_drive' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'google_drive' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'google_drive' => 'googleDrive' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'google_drive' => 'setGoogleDrive' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'google_drive' => 'getGoogleDrive' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('google_drive', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets google_drive + * + * @return string|null + */ + public function getGoogleDrive(): ?string + { + return $this->container['google_drive']; + } + + /** + * Sets google_drive + * + * @param string|null $google_drive If the score is a file on Google Drive, this field property must contain its identifier. To use this method, the Drive file must be public or the Flat Drive App must have access to the file. + * + * @return $this + */ + public function setGoogleDrive(?string $google_drive): static + { + if (is_null($google_drive)) { + throw new InvalidArgumentException('non-nullable google_drive cannot be null'); + } + $this->container['google_drive'] = $google_drive; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreSummary.php b/src/Model/ScoreSummary.php new file mode 100644 index 0000000..5a1def6 --- /dev/null +++ b/src/Model/ScoreSummary.php @@ -0,0 +1,570 @@ + + */ +class ScoreSummary implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreSummary'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'sharing_key' => 'string', + 'title' => 'string', + 'privacy' => '\Flat\APIClient\Model\ScorePrivacy', + 'user' => '\Flat\APIClient\Model\UserPublic', + 'html_url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'sharing_key' => null, + 'title' => null, + 'privacy' => null, + 'user' => null, + 'html_url' => 'url' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'sharing_key' => false, + 'title' => false, + 'privacy' => false, + 'user' => false, + 'html_url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'sharing_key' => 'sharingKey', + 'title' => 'title', + 'privacy' => 'privacy', + 'user' => 'user', + 'html_url' => 'htmlUrl' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'sharing_key' => 'setSharingKey', + 'title' => 'setTitle', + 'privacy' => 'setPrivacy', + 'user' => 'setUser', + 'html_url' => 'setHtmlUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'sharing_key' => 'getSharingKey', + 'title' => 'getTitle', + 'privacy' => 'getPrivacy', + 'user' => 'getUser', + 'html_url' => 'getHtmlUrl' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('sharing_key', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('privacy', $data ?? [], null); + $this->setIfExists('user', $data ?? [], null); + $this->setIfExists('html_url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['title'] === null) { + $invalidProperties[] = "'title' can't be null"; + } + if ($this->container['privacy'] === null) { + $invalidProperties[] = "'privacy' can't be null"; + } + if ($this->container['user'] === null) { + $invalidProperties[] = "'user' can't be null"; + } + if ($this->container['html_url'] === null) { + $invalidProperties[] = "'html_url' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The unique identifier of the score + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sharing_key + * + * @return string|null + */ + public function getSharingKey(): ?string + { + return $this->container['sharing_key']; + } + + /** + * Sets sharing_key + * + * @param string|null $sharing_key The private sharing key of the score (available when the `privacy` mode is set to `privateLink`) + * + * @return $this + */ + public function setSharingKey(?string $sharing_key): static + { + if (is_null($sharing_key)) { + throw new InvalidArgumentException('non-nullable sharing_key cannot be null'); + } + $this->container['sharing_key'] = $sharing_key; + + return $this; + } + + /** + * Gets title + * + * @return string + */ + public function getTitle(): string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string $title The title of the score + * + * @return $this + */ + public function setTitle(string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets privacy + * + * @return \Flat\APIClient\Model\ScorePrivacy + */ + public function getPrivacy(): \Flat\APIClient\Model\ScorePrivacy + { + return $this->container['privacy']; + } + + /** + * Sets privacy + * + * @param \Flat\APIClient\Model\ScorePrivacy $privacy privacy + * + * @return $this + */ + public function setPrivacy(\Flat\APIClient\Model\ScorePrivacy $privacy): static + { + if (is_null($privacy)) { + throw new InvalidArgumentException('non-nullable privacy cannot be null'); + } + $this->container['privacy'] = $privacy; + + return $this; + } + + /** + * Gets user + * + * @return \Flat\APIClient\Model\UserPublic + */ + public function getUser(): \Flat\APIClient\Model\UserPublic + { + return $this->container['user']; + } + + /** + * Sets user + * + * @param \Flat\APIClient\Model\UserPublic $user user + * + * @return $this + */ + public function setUser(\Flat\APIClient\Model\UserPublic $user): static + { + if (is_null($user)) { + throw new InvalidArgumentException('non-nullable user cannot be null'); + } + $this->container['user'] = $user; + + return $this; + } + + /** + * Gets html_url + * + * @return string + */ + public function getHtmlUrl(): string + { + return $this->container['html_url']; + } + + /** + * Sets html_url + * + * @param string $html_url The url where the score can be viewed in a web browser + * + * @return $this + */ + public function setHtmlUrl(string $html_url): static + { + if (is_null($html_url)) { + throw new InvalidArgumentException('non-nullable html_url cannot be null'); + } + $this->container['html_url'] = $html_url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreTrack.php b/src/Model/ScoreTrack.php new file mode 100644 index 0000000..5b4f221 --- /dev/null +++ b/src/Model/ScoreTrack.php @@ -0,0 +1,817 @@ + + */ +class ScoreTrack implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreTrack'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'title' => 'string', + 'score' => 'string', + 'creator' => 'string', + 'creation_date' => '\DateTime', + 'modification_date' => '\DateTime', + 'default' => 'bool', + 'state' => '\Flat\APIClient\Model\ScoreTrackState', + 'type' => '\Flat\APIClient\Model\ScoreTrackType', + 'purpose' => '\Flat\APIClient\Model\ScoreTrackPurpose', + 'url' => 'string', + 'media_id' => 'string', + 'synchronization_points' => '\Flat\APIClient\Model\ScoreTrackPoint[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'title' => null, + 'score' => null, + 'creator' => null, + 'creation_date' => 'date-time', + 'modification_date' => 'date-time', + 'default' => null, + 'state' => null, + 'type' => null, + 'purpose' => null, + 'url' => null, + 'media_id' => null, + 'synchronization_points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'title' => false, + 'score' => false, + 'creator' => false, + 'creation_date' => false, + 'modification_date' => false, + 'default' => false, + 'state' => false, + 'type' => false, + 'purpose' => false, + 'url' => false, + 'media_id' => false, + 'synchronization_points' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'title' => 'title', + 'score' => 'score', + 'creator' => 'creator', + 'creation_date' => 'creationDate', + 'modification_date' => 'modificationDate', + 'default' => 'default', + 'state' => 'state', + 'type' => 'type', + 'purpose' => 'purpose', + 'url' => 'url', + 'media_id' => 'mediaId', + 'synchronization_points' => 'synchronizationPoints' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'title' => 'setTitle', + 'score' => 'setScore', + 'creator' => 'setCreator', + 'creation_date' => 'setCreationDate', + 'modification_date' => 'setModificationDate', + 'default' => 'setDefault', + 'state' => 'setState', + 'type' => 'setType', + 'purpose' => 'setPurpose', + 'url' => 'setUrl', + 'media_id' => 'setMediaId', + 'synchronization_points' => 'setSynchronizationPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'title' => 'getTitle', + 'score' => 'getScore', + 'creator' => 'getCreator', + 'creation_date' => 'getCreationDate', + 'modification_date' => 'getModificationDate', + 'default' => 'getDefault', + 'state' => 'getState', + 'type' => 'getType', + 'purpose' => 'getPurpose', + 'url' => 'getUrl', + 'media_id' => 'getMediaId', + 'synchronization_points' => 'getSynchronizationPoints' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('score', $data ?? [], null); + $this->setIfExists('creator', $data ?? [], null); + $this->setIfExists('creation_date', $data ?? [], null); + $this->setIfExists('modification_date', $data ?? [], null); + $this->setIfExists('default', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('purpose', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('media_id', $data ?? [], null); + $this->setIfExists('synchronization_points', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['creator'] === null) { + $invalidProperties[] = "'creator' can't be null"; + } + if ($this->container['creation_date'] === null) { + $invalidProperties[] = "'creation_date' can't be null"; + } + if ($this->container['modification_date'] === null) { + $invalidProperties[] = "'modification_date' can't be null"; + } + if ($this->container['default'] === null) { + $invalidProperties[] = "'default' can't be null"; + } + if ($this->container['state'] === null) { + $invalidProperties[] = "'state' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['purpose'] === null) { + $invalidProperties[] = "'purpose' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The unique identifier of the score track + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle(): ?string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title Title of the track + * + * @return $this + */ + public function setTitle(?string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets score + * + * @return string|null + */ + public function getScore(): ?string + { + return $this->container['score']; + } + + /** + * Sets score + * + * @param string|null $score The unique identifier of the score. Absent for Free Record performance submissions, which are recorded without an attached score. + * + * @return $this + */ + public function setScore(?string $score): static + { + if (is_null($score)) { + throw new InvalidArgumentException('non-nullable score cannot be null'); + } + $this->container['score'] = $score; + + return $this; + } + + /** + * Gets creator + * + * @return string + */ + public function getCreator(): string + { + return $this->container['creator']; + } + + /** + * Sets creator + * + * @param string $creator The unique identifier of the track creator + * + * @return $this + */ + public function setCreator(string $creator): static + { + if (is_null($creator)) { + throw new InvalidArgumentException('non-nullable creator cannot be null'); + } + $this->container['creator'] = $creator; + + return $this; + } + + /** + * Gets creation_date + * + * @return \DateTime + */ + public function getCreationDate(): \DateTime + { + return $this->container['creation_date']; + } + + /** + * Sets creation_date + * + * @param \DateTime $creation_date The creation date of the track + * + * @return $this + */ + public function setCreationDate(\DateTime $creation_date): static + { + if (is_null($creation_date)) { + throw new InvalidArgumentException('non-nullable creation_date cannot be null'); + } + $this->container['creation_date'] = $creation_date; + + return $this; + } + + /** + * Gets modification_date + * + * @return \DateTime + */ + public function getModificationDate(): \DateTime + { + return $this->container['modification_date']; + } + + /** + * Sets modification_date + * + * @param \DateTime $modification_date The modification date of the track + * + * @return $this + */ + public function setModificationDate(\DateTime $modification_date): static + { + if (is_null($modification_date)) { + throw new InvalidArgumentException('non-nullable modification_date cannot be null'); + } + $this->container['modification_date'] = $modification_date; + + return $this; + } + + /** + * Gets default + * + * @return bool + */ + public function getDefault(): bool + { + return $this->container['default']; + } + + /** + * Sets default + * + * @param bool $default True if the track should be used as default audio source + * + * @return $this + */ + public function setDefault(bool $default): static + { + if (is_null($default)) { + throw new InvalidArgumentException('non-nullable default cannot be null'); + } + $this->container['default'] = $default; + + return $this; + } + + /** + * Gets state + * + * @return \Flat\APIClient\Model\ScoreTrackState + */ + public function getState(): \Flat\APIClient\Model\ScoreTrackState + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param \Flat\APIClient\Model\ScoreTrackState $state state + * + * @return $this + */ + public function setState(\Flat\APIClient\Model\ScoreTrackState $state): static + { + if (is_null($state)) { + throw new InvalidArgumentException('non-nullable state cannot be null'); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets type + * + * @return \Flat\APIClient\Model\ScoreTrackType + */ + public function getType(): \Flat\APIClient\Model\ScoreTrackType + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Flat\APIClient\Model\ScoreTrackType $type type + * + * @return $this + */ + public function setType(\Flat\APIClient\Model\ScoreTrackType $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets purpose + * + * @return \Flat\APIClient\Model\ScoreTrackPurpose + */ + public function getPurpose(): \Flat\APIClient\Model\ScoreTrackPurpose + { + return $this->container['purpose']; + } + + /** + * Sets purpose + * + * @param \Flat\APIClient\Model\ScoreTrackPurpose $purpose purpose + * + * @return $this + */ + public function setPurpose(\Flat\APIClient\Model\ScoreTrackPurpose $purpose): static + { + if (is_null($purpose)) { + throw new InvalidArgumentException('non-nullable purpose cannot be null'); + } + $this->container['purpose'] = $purpose; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl(): ?string + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The URL of the track + * + * @return $this + */ + public function setUrl(?string $url): static + { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets media_id + * + * @return string|null + */ + public function getMediaId(): ?string + { + return $this->container['media_id']; + } + + /** + * Sets media_id + * + * @param string|null $media_id The unique identifier of the track when hosted on an external service. For example, if the url is `https://www.youtube.com/watch?v=dQw4w9WgXcQ`, `mediaId` will be `dQw4w9WgXcQ` + * + * @return $this + */ + public function setMediaId(?string $media_id): static + { + if (is_null($media_id)) { + throw new InvalidArgumentException('non-nullable media_id cannot be null'); + } + $this->container['media_id'] = $media_id; + + return $this; + } + + /** + * Gets synchronization_points + * + * @return \Flat\APIClient\Model\ScoreTrackPoint[]|null + */ + public function getSynchronizationPoints(): ?array + { + return $this->container['synchronization_points']; + } + + /** + * Sets synchronization_points + * + * @param \Flat\APIClient\Model\ScoreTrackPoint[]|null $synchronization_points synchronization_points + * + * @return $this + */ + public function setSynchronizationPoints(?array $synchronization_points): static + { + if (is_null($synchronization_points)) { + throw new InvalidArgumentException('non-nullable synchronization_points cannot be null'); + } + $this->container['synchronization_points'] = $synchronization_points; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreTrackCreation.php b/src/Model/ScoreTrackCreation.php new file mode 100644 index 0000000..bc3ca91 --- /dev/null +++ b/src/Model/ScoreTrackCreation.php @@ -0,0 +1,555 @@ + + */ +class ScoreTrackCreation implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreTrackCreation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'title' => 'string', + 'default' => 'bool', + 'state' => '\Flat\APIClient\Model\ScoreTrackState', + 'purpose' => '\Flat\APIClient\Model\ScoreTrackPurpose', + 'url' => 'string', + 'synchronization_points' => '\Flat\APIClient\Model\ScoreTrackPoint[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'title' => null, + 'default' => null, + 'state' => null, + 'purpose' => null, + 'url' => null, + 'synchronization_points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'title' => false, + 'default' => false, + 'state' => false, + 'purpose' => false, + 'url' => false, + 'synchronization_points' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'title' => 'title', + 'default' => 'default', + 'state' => 'state', + 'purpose' => 'purpose', + 'url' => 'url', + 'synchronization_points' => 'synchronizationPoints' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'title' => 'setTitle', + 'default' => 'setDefault', + 'state' => 'setState', + 'purpose' => 'setPurpose', + 'url' => 'setUrl', + 'synchronization_points' => 'setSynchronizationPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'title' => 'getTitle', + 'default' => 'getDefault', + 'state' => 'getState', + 'purpose' => 'getPurpose', + 'url' => 'getUrl', + 'synchronization_points' => 'getSynchronizationPoints' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('default', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('purpose', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('synchronization_points', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets title + * + * @return string|null + */ + public function getTitle(): ?string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title Title of the track + * + * @return $this + */ + public function setTitle(?string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets default + * + * @return bool|null + */ + public function getDefault(): ?bool + { + return $this->container['default']; + } + + /** + * Sets default + * + * @param bool|null $default True if the track should be used as default audio source + * + * @return $this + */ + public function setDefault(?bool $default): static + { + if (is_null($default)) { + throw new InvalidArgumentException('non-nullable default cannot be null'); + } + $this->container['default'] = $default; + + return $this; + } + + /** + * Gets state + * + * @return \Flat\APIClient\Model\ScoreTrackState|null + */ + public function getState(): ?\Flat\APIClient\Model\ScoreTrackState + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param \Flat\APIClient\Model\ScoreTrackState|null $state state + * + * @return $this + */ + public function setState(?\Flat\APIClient\Model\ScoreTrackState $state): static + { + if (is_null($state)) { + throw new InvalidArgumentException('non-nullable state cannot be null'); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets purpose + * + * @return \Flat\APIClient\Model\ScoreTrackPurpose|null + */ + public function getPurpose(): ?\Flat\APIClient\Model\ScoreTrackPurpose + { + return $this->container['purpose']; + } + + /** + * Sets purpose + * + * @param \Flat\APIClient\Model\ScoreTrackPurpose|null $purpose purpose + * + * @return $this + */ + public function setPurpose(?\Flat\APIClient\Model\ScoreTrackPurpose $purpose): static + { + if (is_null($purpose)) { + throw new InvalidArgumentException('non-nullable purpose cannot be null'); + } + $this->container['purpose'] = $purpose; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl(): ?string + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The URL of the track + * + * @return $this + */ + public function setUrl(?string $url): static + { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets synchronization_points + * + * @return \Flat\APIClient\Model\ScoreTrackPoint[]|null + */ + public function getSynchronizationPoints(): ?array + { + return $this->container['synchronization_points']; + } + + /** + * Sets synchronization_points + * + * @param \Flat\APIClient\Model\ScoreTrackPoint[]|null $synchronization_points synchronization_points + * + * @return $this + */ + public function setSynchronizationPoints(?array $synchronization_points): static + { + if (is_null($synchronization_points)) { + throw new InvalidArgumentException('non-nullable synchronization_points cannot be null'); + } + $this->container['synchronization_points'] = $synchronization_points; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreTrackCreationResponse.php b/src/Model/ScoreTrackCreationResponse.php new file mode 100644 index 0000000..049120d --- /dev/null +++ b/src/Model/ScoreTrackCreationResponse.php @@ -0,0 +1,388 @@ + + */ +class ScoreTrackCreationResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreTrackCreationResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'track' => '\Flat\APIClient\Model\ScoreTrack' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'track' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'track' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'track' => 'track' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'track' => 'setTrack' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'track' => 'getTrack' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('track', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['track'] === null) { + $invalidProperties[] = "'track' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets track + * + * @return \Flat\APIClient\Model\ScoreTrack + */ + public function getTrack(): \Flat\APIClient\Model\ScoreTrack + { + return $this->container['track']; + } + + /** + * Sets track + * + * @param \Flat\APIClient\Model\ScoreTrack $track track + * + * @return $this + */ + public function setTrack(\Flat\APIClient\Model\ScoreTrack $track): static + { + if (is_null($track)) { + throw new InvalidArgumentException('non-nullable track cannot be null'); + } + $this->container['track'] = $track; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreTrackPoint.php b/src/Model/ScoreTrackPoint.php new file mode 100644 index 0000000..9439afa --- /dev/null +++ b/src/Model/ScoreTrackPoint.php @@ -0,0 +1,493 @@ + + */ +class ScoreTrackPoint implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreTrackPoint'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => 'string', + 'measure_uuid' => 'string', + 'time' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'measure_uuid' => 'uuid', + 'time' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'measure_uuid' => false, + 'time' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'measure_uuid' => 'measureUuid', + 'time' => 'time' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'measure_uuid' => 'setMeasureUuid', + 'time' => 'setTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'measure_uuid' => 'getMeasureUuid', + 'time' => 'getTime' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const TYPE_MEASURE = 'measure'; + public const TYPE_END = 'end'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getTypeAllowableValues() + { + return [ + self::TYPE_MEASURE, + self::TYPE_END, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('measure_uuid', $data ?? [], null); + $this->setIfExists('time', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + $allowedValues = self::getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['time'] === null) { + $invalidProperties[] = "'time' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string + */ + public function getType(): string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type The type of the synchronization point. If the type is `measure`, the measure uuid must be present in `measureUuid` + * + * @return $this + */ + public function setType(string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = self::getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets measure_uuid + * + * @return string|null + */ + public function getMeasureUuid(): ?string + { + return $this->container['measure_uuid']; + } + + /** + * Sets measure_uuid + * + * @param string|null $measure_uuid The measure unique identifier + * + * @return $this + */ + public function setMeasureUuid(?string $measure_uuid): static + { + if (is_null($measure_uuid)) { + throw new InvalidArgumentException('non-nullable measure_uuid cannot be null'); + } + $this->container['measure_uuid'] = $measure_uuid; + + return $this; + } + + /** + * Gets time + * + * @return float + */ + public function getTime(): float + { + return $this->container['time']; + } + + /** + * Sets time + * + * @param float $time The corresponding time in seconds + * + * @return $this + */ + public function setTime(float $time): static + { + if (is_null($time)) { + throw new InvalidArgumentException('non-nullable time cannot be null'); + } + $this->container['time'] = $time; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreTrackPurpose.php b/src/Model/ScoreTrackPurpose.php new file mode 100644 index 0000000..cf8b880 --- /dev/null +++ b/src/Model/ScoreTrackPurpose.php @@ -0,0 +1,46 @@ + + */ +class ScoreTrackUpdate implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreTrackUpdate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'title' => 'string', + 'default' => 'bool', + 'state' => '\Flat\APIClient\Model\ScoreTrackState', + 'purpose' => '\Flat\APIClient\Model\ScoreTrackPurpose', + 'synchronization_points' => '\Flat\APIClient\Model\ScoreTrackPoint[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'title' => null, + 'default' => null, + 'state' => null, + 'purpose' => null, + 'synchronization_points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'title' => false, + 'default' => false, + 'state' => false, + 'purpose' => false, + 'synchronization_points' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'title' => 'title', + 'default' => 'default', + 'state' => 'state', + 'purpose' => 'purpose', + 'synchronization_points' => 'synchronizationPoints' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'title' => 'setTitle', + 'default' => 'setDefault', + 'state' => 'setState', + 'purpose' => 'setPurpose', + 'synchronization_points' => 'setSynchronizationPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'title' => 'getTitle', + 'default' => 'getDefault', + 'state' => 'getState', + 'purpose' => 'getPurpose', + 'synchronization_points' => 'getSynchronizationPoints' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('default', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('purpose', $data ?? [], null); + $this->setIfExists('synchronization_points', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets title + * + * @return string|null + */ + public function getTitle(): ?string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title Title of the track + * + * @return $this + */ + public function setTitle(?string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets default + * + * @return bool|null + */ + public function getDefault(): ?bool + { + return $this->container['default']; + } + + /** + * Sets default + * + * @param bool|null $default True if the track should be used as default audio source + * + * @return $this + */ + public function setDefault(?bool $default): static + { + if (is_null($default)) { + throw new InvalidArgumentException('non-nullable default cannot be null'); + } + $this->container['default'] = $default; + + return $this; + } + + /** + * Gets state + * + * @return \Flat\APIClient\Model\ScoreTrackState|null + */ + public function getState(): ?\Flat\APIClient\Model\ScoreTrackState + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param \Flat\APIClient\Model\ScoreTrackState|null $state state + * + * @return $this + */ + public function setState(?\Flat\APIClient\Model\ScoreTrackState $state): static + { + if (is_null($state)) { + throw new InvalidArgumentException('non-nullable state cannot be null'); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets purpose + * + * @return \Flat\APIClient\Model\ScoreTrackPurpose|null + */ + public function getPurpose(): ?\Flat\APIClient\Model\ScoreTrackPurpose + { + return $this->container['purpose']; + } + + /** + * Sets purpose + * + * @param \Flat\APIClient\Model\ScoreTrackPurpose|null $purpose purpose + * + * @return $this + */ + public function setPurpose(?\Flat\APIClient\Model\ScoreTrackPurpose $purpose): static + { + if (is_null($purpose)) { + throw new InvalidArgumentException('non-nullable purpose cannot be null'); + } + $this->container['purpose'] = $purpose; + + return $this; + } + + /** + * Gets synchronization_points + * + * @return \Flat\APIClient\Model\ScoreTrackPoint[]|null + */ + public function getSynchronizationPoints(): ?array + { + return $this->container['synchronization_points']; + } + + /** + * Sets synchronization_points + * + * @param \Flat\APIClient\Model\ScoreTrackPoint[]|null $synchronization_points synchronization_points + * + * @return $this + */ + public function setSynchronizationPoints(?array $synchronization_points): static + { + if (is_null($synchronization_points)) { + throw new InvalidArgumentException('non-nullable synchronization_points cannot be null'); + } + $this->container['synchronization_points'] = $synchronization_points; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ScoreViewsCounts.php b/src/Model/ScoreViewsCounts.php new file mode 100644 index 0000000..738f562 --- /dev/null +++ b/src/Model/ScoreViewsCounts.php @@ -0,0 +1,487 @@ + + */ +class ScoreViewsCounts implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ScoreViewsCounts'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'total' => 'float', + 'weekly' => 'float', + 'monthly' => 'float', + 'yearly' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'total' => null, + 'weekly' => null, + 'monthly' => null, + 'yearly' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'total' => false, + 'weekly' => false, + 'monthly' => false, + 'yearly' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'total' => 'total', + 'weekly' => 'weekly', + 'monthly' => 'monthly', + 'yearly' => 'yearly' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'total' => 'setTotal', + 'weekly' => 'setWeekly', + 'monthly' => 'setMonthly', + 'yearly' => 'setYearly' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'total' => 'getTotal', + 'weekly' => 'getWeekly', + 'monthly' => 'getMonthly', + 'yearly' => 'getYearly' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('weekly', $data ?? [], null); + $this->setIfExists('monthly', $data ?? [], null); + $this->setIfExists('yearly', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets total + * + * @return float|null + */ + public function getTotal(): ?float + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param float|null $total The total number of views of the score + * + * @return $this + */ + public function setTotal(?float $total): static + { + if (is_null($total)) { + throw new InvalidArgumentException('non-nullable total cannot be null'); + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets weekly + * + * @return float|null + */ + public function getWeekly(): ?float + { + return $this->container['weekly']; + } + + /** + * Sets weekly + * + * @param float|null $weekly The weekly number of views of the score + * + * @return $this + */ + public function setWeekly(?float $weekly): static + { + if (is_null($weekly)) { + throw new InvalidArgumentException('non-nullable weekly cannot be null'); + } + $this->container['weekly'] = $weekly; + + return $this; + } + + /** + * Gets monthly + * + * @return float|null + */ + public function getMonthly(): ?float + { + return $this->container['monthly']; + } + + /** + * Sets monthly + * + * @param float|null $monthly The monthly number of views of the score + * + * @return $this + */ + public function setMonthly(?float $monthly): static + { + if (is_null($monthly)) { + throw new InvalidArgumentException('non-nullable monthly cannot be null'); + } + $this->container['monthly'] = $monthly; + + return $this; + } + + /** + * Gets yearly + * + * @return float|null + */ + public function getYearly(): ?float + { + return $this->container['yearly']; + } + + /** + * Sets yearly + * + * @param float|null $yearly The yearly number of views of the score + * + * @return $this + */ + public function setYearly(?float $yearly): static + { + if (is_null($yearly)) { + throw new InvalidArgumentException('non-nullable yearly cannot be null'); + } + $this->container['yearly'] = $yearly; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/Task.php b/src/Model/Task.php new file mode 100644 index 0000000..bd27d94 --- /dev/null +++ b/src/Model/Task.php @@ -0,0 +1,875 @@ + + */ +class Task implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'Task'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'type' => 'string', + 'state' => 'string', + 'format' => 'string', + 'score' => 'string', + 'revision' => 'string', + 'progress' => '\Flat\APIClient\Model\TaskProgress', + 'creation_date' => '\DateTime', + 'modification_date' => '\DateTime', + 'done_date' => '\DateTime', + 'result' => '\Flat\APIClient\Model\TaskResult', + 'error_history' => 'string[]', + 'is_cancellable' => 'bool', + 'children' => '\Flat\APIClient\Model\Task[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'type' => null, + 'state' => null, + 'format' => null, + 'score' => null, + 'revision' => null, + 'progress' => null, + 'creation_date' => 'date-time', + 'modification_date' => 'date-time', + 'done_date' => 'date-time', + 'result' => null, + 'error_history' => null, + 'is_cancellable' => null, + 'children' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'type' => false, + 'state' => false, + 'format' => false, + 'score' => false, + 'revision' => false, + 'progress' => false, + 'creation_date' => false, + 'modification_date' => false, + 'done_date' => false, + 'result' => false, + 'error_history' => false, + 'is_cancellable' => false, + 'children' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'type' => 'type', + 'state' => 'state', + 'format' => 'format', + 'score' => 'score', + 'revision' => 'revision', + 'progress' => 'progress', + 'creation_date' => 'creationDate', + 'modification_date' => 'modificationDate', + 'done_date' => 'doneDate', + 'result' => 'result', + 'error_history' => 'errorHistory', + 'is_cancellable' => 'isCancellable', + 'children' => 'children' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'type' => 'setType', + 'state' => 'setState', + 'format' => 'setFormat', + 'score' => 'setScore', + 'revision' => 'setRevision', + 'progress' => 'setProgress', + 'creation_date' => 'setCreationDate', + 'modification_date' => 'setModificationDate', + 'done_date' => 'setDoneDate', + 'result' => 'setResult', + 'error_history' => 'setErrorHistory', + 'is_cancellable' => 'setIsCancellable', + 'children' => 'setChildren' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'type' => 'getType', + 'state' => 'getState', + 'format' => 'getFormat', + 'score' => 'getScore', + 'revision' => 'getRevision', + 'progress' => 'getProgress', + 'creation_date' => 'getCreationDate', + 'modification_date' => 'getModificationDate', + 'done_date' => 'getDoneDate', + 'result' => 'getResult', + 'error_history' => 'getErrorHistory', + 'is_cancellable' => 'getIsCancellable', + 'children' => 'getChildren' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const STATE_CREATED = 'created'; + public const STATE_BLOCKED = 'blocked'; + public const STATE_DOING = 'doing'; + public const STATE_DONE = 'done'; + public const STATE_CANCELED = 'canceled'; + public const STATE_ERROR = 'error'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getStateAllowableValues() + { + return [ + self::STATE_CREATED, + self::STATE_BLOCKED, + self::STATE_DOING, + self::STATE_DONE, + self::STATE_CANCELED, + self::STATE_ERROR, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('format', $data ?? [], null); + $this->setIfExists('score', $data ?? [], null); + $this->setIfExists('revision', $data ?? [], null); + $this->setIfExists('progress', $data ?? [], null); + $this->setIfExists('creation_date', $data ?? [], null); + $this->setIfExists('modification_date', $data ?? [], null); + $this->setIfExists('done_date', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('error_history', $data ?? [], null); + $this->setIfExists('is_cancellable', $data ?? [], null); + $this->setIfExists('children', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['state'] === null) { + $invalidProperties[] = "'state' can't be null"; + } + $allowedValues = self::getStateAllowableValues(); + if (!is_null($this->container['state']) && !in_array($this->container['state'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'state', must be one of '%s'", + $this->container['state'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Unique identifier of the task + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType(): ?string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Type of the task: * `audio-export`: Exports a score to audio format (MP3, WAV) * `score-save`: Saves or updates a score document * `import-omr`: Processes a PDF through OMR (Optical Music Recognition) and imports it as a score + * + * @return $this + */ + public function setType(?string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets state + * + * @return string + */ + public function getState(): string + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string $state State of the Task + * + * @return $this + */ + public function setState(string $state): static + { + if (is_null($state)) { + throw new InvalidArgumentException('non-nullable state cannot be null'); + } + $allowedValues = self::getStateAllowableValues(); + if (!in_array($state, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'state', must be one of '%s'", + $state, + implode("', '", $allowedValues) + ) + ); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets format + * + * @return string|null + */ + public function getFormat(): ?string + { + return $this->container['format']; + } + + /** + * Sets format + * + * @param string|null $format For files processing, the file format (e.g. `mp3`, `wav`) + * + * @return $this + */ + public function setFormat(?string $format): static + { + if (is_null($format)) { + throw new InvalidArgumentException('non-nullable format cannot be null'); + } + $this->container['format'] = $format; + + return $this; + } + + /** + * Gets score + * + * @return string|null + */ + public function getScore(): ?string + { + return $this->container['score']; + } + + /** + * Sets score + * + * @param string|null $score The score unique identifier for tasks related to scores + * + * @return $this + */ + public function setScore(?string $score): static + { + if (is_null($score)) { + throw new InvalidArgumentException('non-nullable score cannot be null'); + } + $this->container['score'] = $score; + + return $this; + } + + /** + * Gets revision + * + * @return string|null + */ + public function getRevision(): ?string + { + return $this->container['revision']; + } + + /** + * Sets revision + * + * @param string|null $revision The score revision identifier for tasks related to scores + * + * @return $this + */ + public function setRevision(?string $revision): static + { + if (is_null($revision)) { + throw new InvalidArgumentException('non-nullable revision cannot be null'); + } + $this->container['revision'] = $revision; + + return $this; + } + + /** + * Gets progress + * + * @return \Flat\APIClient\Model\TaskProgress|null + */ + public function getProgress(): ?\Flat\APIClient\Model\TaskProgress + { + return $this->container['progress']; + } + + /** + * Sets progress + * + * @param \Flat\APIClient\Model\TaskProgress|null $progress progress + * + * @return $this + */ + public function setProgress(?\Flat\APIClient\Model\TaskProgress $progress): static + { + if (is_null($progress)) { + throw new InvalidArgumentException('non-nullable progress cannot be null'); + } + $this->container['progress'] = $progress; + + return $this; + } + + /** + * Gets creation_date + * + * @return \DateTime|null + */ + public function getCreationDate(): ?\DateTime + { + return $this->container['creation_date']; + } + + /** + * Sets creation_date + * + * @param \DateTime|null $creation_date The creation date of the task + * + * @return $this + */ + public function setCreationDate(?\DateTime $creation_date): static + { + if (is_null($creation_date)) { + throw new InvalidArgumentException('non-nullable creation_date cannot be null'); + } + $this->container['creation_date'] = $creation_date; + + return $this; + } + + /** + * Gets modification_date + * + * @return \DateTime|null + */ + public function getModificationDate(): ?\DateTime + { + return $this->container['modification_date']; + } + + /** + * Sets modification_date + * + * @param \DateTime|null $modification_date The last modification date of the task + * + * @return $this + */ + public function setModificationDate(?\DateTime $modification_date): static + { + if (is_null($modification_date)) { + throw new InvalidArgumentException('non-nullable modification_date cannot be null'); + } + $this->container['modification_date'] = $modification_date; + + return $this; + } + + /** + * Gets done_date + * + * @return \DateTime|null + */ + public function getDoneDate(): ?\DateTime + { + return $this->container['done_date']; + } + + /** + * Sets done_date + * + * @param \DateTime|null $done_date The date when the task has been completed + * + * @return $this + */ + public function setDoneDate(?\DateTime $done_date): static + { + if (is_null($done_date)) { + throw new InvalidArgumentException('non-nullable done_date cannot be null'); + } + $this->container['done_date'] = $done_date; + + return $this; + } + + /** + * Gets result + * + * @return \Flat\APIClient\Model\TaskResult|null + */ + public function getResult(): ?\Flat\APIClient\Model\TaskResult + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \Flat\APIClient\Model\TaskResult|null $result result + * + * @return $this + */ + public function setResult(?\Flat\APIClient\Model\TaskResult $result): static + { + if (is_null($result)) { + throw new InvalidArgumentException('non-nullable result cannot be null'); + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets error_history + * + * @return string[]|null + */ + public function getErrorHistory(): ?array + { + return $this->container['error_history']; + } + + /** + * Sets error_history + * + * @param string[]|null $error_history If any errors happened when processing this task, the list of errors identifiers + * + * @return $this + */ + public function setErrorHistory(?array $error_history): static + { + if (is_null($error_history)) { + throw new InvalidArgumentException('non-nullable error_history cannot be null'); + } + $this->container['error_history'] = $error_history; + + return $this; + } + + /** + * Gets is_cancellable + * + * @return bool|null + */ + public function getIsCancellable(): ?bool + { + return $this->container['is_cancellable']; + } + + /** + * Sets is_cancellable + * + * @param bool|null $is_cancellable Whether the task can be canceled by the user. Only `true` when the task is in `created` state (waiting to be processed). + * + * @return $this + */ + public function setIsCancellable(?bool $is_cancellable): static + { + if (is_null($is_cancellable)) { + throw new InvalidArgumentException('non-nullable is_cancellable cannot be null'); + } + $this->container['is_cancellable'] = $is_cancellable; + + return $this; + } + + /** + * Gets children + * + * @return \Flat\APIClient\Model\Task[]|null + */ + public function getChildren(): ?array + { + return $this->container['children']; + } + + /** + * Sets children + * + * @param \Flat\APIClient\Model\Task[]|null $children Child tasks for hierarchical task structures (e.g., conversion subtasks) + * + * @return $this + */ + public function setChildren(?array $children): static + { + if (is_null($children)) { + throw new InvalidArgumentException('non-nullable children cannot be null'); + } + $this->container['children'] = $children; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/TaskExportOptions.php b/src/Model/TaskExportOptions.php new file mode 100644 index 0000000..6483cf3 --- /dev/null +++ b/src/Model/TaskExportOptions.php @@ -0,0 +1,385 @@ + + */ +class TaskExportOptions implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'TaskExportOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'parts' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'parts' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'parts' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'parts' => 'parts' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'parts' => 'setParts' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'parts' => 'getParts' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('parts', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets parts + * + * @return string[]|null + */ + public function getParts(): ?array + { + return $this->container['parts']; + } + + /** + * Sets parts + * + * @param string[]|null $parts A list of parts to specifically export + * + * @return $this + */ + public function setParts(?array $parts): static + { + if (is_null($parts)) { + throw new InvalidArgumentException('non-nullable parts cannot be null'); + } + $this->container['parts'] = $parts; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/TaskProgress.php b/src/Model/TaskProgress.php new file mode 100644 index 0000000..de80d58 --- /dev/null +++ b/src/Model/TaskProgress.php @@ -0,0 +1,419 @@ + + */ +class TaskProgress implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'Task_progress'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'percent' => 'float', + 'text' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'percent' => null, + 'text' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'percent' => false, + 'text' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'percent' => 'percent', + 'text' => 'text' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'percent' => 'setPercent', + 'text' => 'setText' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'percent' => 'getPercent', + 'text' => 'getText' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('percent', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets percent + * + * @return float|null + */ + public function getPercent(): ?float + { + return $this->container['percent']; + } + + /** + * Sets percent + * + * @param float|null $percent Percent of the task progression + * + * @return $this + */ + public function setPercent(?float $percent): static + { + if (is_null($percent)) { + throw new InvalidArgumentException('non-nullable percent cannot be null'); + } + $this->container['percent'] = $percent; + + return $this; + } + + /** + * Gets text + * + * @return string|null + */ + public function getText(): ?string + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string|null $text Text details of the task progress + * + * @return $this + */ + public function setText(?string $text): static + { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } + $this->container['text'] = $text; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/TaskResult.php b/src/Model/TaskResult.php new file mode 100644 index 0000000..180f5a3 --- /dev/null +++ b/src/Model/TaskResult.php @@ -0,0 +1,419 @@ + + */ +class TaskResult implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'Task_result'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'url' => 'string', + 'error' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'url' => null, + 'error' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'url' => false, + 'error' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'url' => 'url', + 'error' => 'error' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'url' => 'setUrl', + 'error' => 'setError' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'url' => 'getUrl', + 'error' => 'getError' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets url + * + * @return string|null + */ + public function getUrl(): ?string + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url URL returned by the task worker + * + * @return $this + */ + public function setUrl(?string $url): static + { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets error + * + * @return string|null + */ + public function getError(): ?string + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string|null $error Error returned by task worker + * + * @return $this + */ + public function setError(?string $error): static + { + if (is_null($error)) { + throw new InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/TeachingTheme.php b/src/Model/TeachingTheme.php new file mode 100644 index 0000000..fd85a89 --- /dev/null +++ b/src/Model/TeachingTheme.php @@ -0,0 +1,60 @@ + + */ +class UserAdminUpdate implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'UserAdminUpdate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'password' => 'string', + 'organization_role' => '\Flat\APIClient\Model\OrganizationRoles', + 'username' => 'string', + 'firstname' => 'string', + 'lastname' => 'string', + 'email' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'password' => 'password', + 'organization_role' => null, + 'username' => null, + 'firstname' => null, + 'lastname' => null, + 'email' => 'email' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'password' => false, + 'organization_role' => false, + 'username' => false, + 'firstname' => false, + 'lastname' => false, + 'email' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'password' => 'password', + 'organization_role' => 'organizationRole', + 'username' => 'username', + 'firstname' => 'firstname', + 'lastname' => 'lastname', + 'email' => 'email' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'password' => 'setPassword', + 'organization_role' => 'setOrganizationRole', + 'username' => 'setUsername', + 'firstname' => 'setFirstname', + 'lastname' => 'setLastname', + 'email' => 'setEmail' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'password' => 'getPassword', + 'organization_role' => 'getOrganizationRole', + 'username' => 'getUsername', + 'firstname' => 'getFirstname', + 'lastname' => 'getLastname', + 'email' => 'getEmail' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('password', $data ?? [], null); + $this->setIfExists('organization_role', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('firstname', $data ?? [], null); + $this->setIfExists('lastname', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['password']) && (mb_strlen($this->container['password']) > 1000)) { + $invalidProperties[] = "invalid value for 'password', the character length must be smaller than or equal to 1000."; + } + + if (!is_null($this->container['password']) && (mb_strlen($this->container['password']) < 6)) { + $invalidProperties[] = "invalid value for 'password', the character length must be bigger than or equal to 6."; + } + + if (!is_null($this->container['username']) && (mb_strlen($this->container['username']) > 30)) { + $invalidProperties[] = "invalid value for 'username', the character length must be smaller than or equal to 30."; + } + + if (!is_null($this->container['username']) && (mb_strlen($this->container['username']) < 1)) { + $invalidProperties[] = "invalid value for 'username', the character length must be bigger than or equal to 1."; + } + + if (!is_null($this->container['firstname']) && (mb_strlen($this->container['firstname']) > 60)) { + $invalidProperties[] = "invalid value for 'firstname', the character length must be smaller than or equal to 60."; + } + + if (!is_null($this->container['lastname']) && (mb_strlen($this->container['lastname']) > 60)) { + $invalidProperties[] = "invalid value for 'lastname', the character length must be smaller than or equal to 60."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets password + * + * @return string|null + */ + public function getPassword(): ?string + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string|null $password Password of the account + * + * @return $this + */ + public function setPassword(?string $password): static + { + if (is_null($password)) { + throw new InvalidArgumentException('non-nullable password cannot be null'); + } + if ((mb_strlen($password) > 1000)) { + throw new InvalidArgumentException('invalid length for $password when calling UserAdminUpdate., must be smaller than or equal to 1000.'); + } + if ((mb_strlen($password) < 6)) { + throw new InvalidArgumentException('invalid length for $password when calling UserAdminUpdate., must be bigger than or equal to 6.'); + } + + $this->container['password'] = $password; + + return $this; + } + + /** + * Gets organization_role + * + * @return \Flat\APIClient\Model\OrganizationRoles|null + */ + public function getOrganizationRole(): ?\Flat\APIClient\Model\OrganizationRoles + { + return $this->container['organization_role']; + } + + /** + * Sets organization_role + * + * @param \Flat\APIClient\Model\OrganizationRoles|null $organization_role organization_role + * + * @return $this + */ + public function setOrganizationRole(?\Flat\APIClient\Model\OrganizationRoles $organization_role): static + { + if (is_null($organization_role)) { + throw new InvalidArgumentException('non-nullable organization_role cannot be null'); + } + $this->container['organization_role'] = $organization_role; + + return $this; + } + + /** + * Gets username + * + * @return string|null + */ + public function getUsername(): ?string + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string|null $username Username of the account + * + * @return $this + */ + public function setUsername(?string $username): static + { + if (is_null($username)) { + throw new InvalidArgumentException('non-nullable username cannot be null'); + } + if ((mb_strlen($username) > 30)) { + throw new InvalidArgumentException('invalid length for $username when calling UserAdminUpdate., must be smaller than or equal to 30.'); + } + if ((mb_strlen($username) < 1)) { + throw new InvalidArgumentException('invalid length for $username when calling UserAdminUpdate., must be bigger than or equal to 1.'); + } + + $this->container['username'] = $username; + + return $this; + } + + /** + * Gets firstname + * + * @return string|null + */ + public function getFirstname(): ?string + { + return $this->container['firstname']; + } + + /** + * Sets firstname + * + * @param string|null $firstname First name of the user + * + * @return $this + */ + public function setFirstname(?string $firstname): static + { + if (is_null($firstname)) { + throw new InvalidArgumentException('non-nullable firstname cannot be null'); + } + if ((mb_strlen($firstname) > 60)) { + throw new InvalidArgumentException('invalid length for $firstname when calling UserAdminUpdate., must be smaller than or equal to 60.'); + } + + $this->container['firstname'] = $firstname; + + return $this; + } + + /** + * Gets lastname + * + * @return string|null + */ + public function getLastname(): ?string + { + return $this->container['lastname']; + } + + /** + * Sets lastname + * + * @param string|null $lastname Last name of the user + * + * @return $this + */ + public function setLastname(?string $lastname): static + { + if (is_null($lastname)) { + throw new InvalidArgumentException('non-nullable lastname cannot be null'); + } + if ((mb_strlen($lastname) > 60)) { + throw new InvalidArgumentException('invalid length for $lastname when calling UserAdminUpdate., must be smaller than or equal to 60.'); + } + + $this->container['lastname'] = $lastname; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail(): ?string + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Email of the account + * + * @return $this + */ + public function setEmail(?string $email): static + { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/UserAzureDetails.php b/src/Model/UserAzureDetails.php new file mode 100644 index 0000000..1f6743e --- /dev/null +++ b/src/Model/UserAzureDetails.php @@ -0,0 +1,452 @@ + + */ +class UserAzureDetails implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'UserAzureDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'oid' => 'string', + 'hd' => 'string', + 'preferred_username' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'oid' => null, + 'hd' => null, + 'preferred_username' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'oid' => false, + 'hd' => false, + 'preferred_username' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'oid' => 'oid', + 'hd' => 'hd', + 'preferred_username' => 'preferredUsername' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'oid' => 'setOid', + 'hd' => 'setHd', + 'preferred_username' => 'setPreferredUsername' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'oid' => 'getOid', + 'hd' => 'getHd', + 'preferred_username' => 'getPreferredUsername' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('oid', $data ?? [], null); + $this->setIfExists('hd', $data ?? [], null); + $this->setIfExists('preferred_username', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets oid + * + * @return string|null + */ + public function getOid(): ?string + { + return $this->container['oid']; + } + + /** + * Sets oid + * + * @param string|null $oid User object identifier on Azure AD + * + * @return $this + */ + public function setOid(?string $oid): static + { + if (is_null($oid)) { + throw new InvalidArgumentException('non-nullable oid cannot be null'); + } + $this->container['oid'] = $oid; + + return $this; + } + + /** + * Gets hd + * + * @return string|null + */ + public function getHd(): ?string + { + return $this->container['hd']; + } + + /** + * Sets hd + * + * @param string|null $hd User tenant (domain name) + * + * @return $this + */ + public function setHd(?string $hd): static + { + if (is_null($hd)) { + throw new InvalidArgumentException('non-nullable hd cannot be null'); + } + $this->container['hd'] = $hd; + + return $this; + } + + /** + * Gets preferred_username + * + * @return string|null + */ + public function getPreferredUsername(): ?string + { + return $this->container['preferred_username']; + } + + /** + * Sets preferred_username + * + * @param string|null $preferred_username User Preferred Username (UPN), i.e. the main email of the user + * + * @return $this + */ + public function setPreferredUsername(?string $preferred_username): static + { + if (is_null($preferred_username)) { + throw new InvalidArgumentException('non-nullable preferred_username cannot be null'); + } + $this->container['preferred_username'] = $preferred_username; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/UserBasics.php b/src/Model/UserBasics.php new file mode 100644 index 0000000..c300df2 --- /dev/null +++ b/src/Model/UserBasics.php @@ -0,0 +1,746 @@ + + */ +class UserBasics implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'UserBasics'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'type' => 'string', + 'product' => '\Flat\APIClient\Model\TutteoProduct', + 'username' => 'string', + 'printable_name' => 'string', + 'firstname' => 'string', + 'lastname' => 'string', + 'name' => 'string', + 'picture' => 'string', + 'badges' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'type' => null, + 'product' => null, + 'username' => null, + 'printable_name' => null, + 'firstname' => null, + 'lastname' => null, + 'name' => null, + 'picture' => null, + 'badges' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'type' => false, + 'product' => false, + 'username' => false, + 'printable_name' => false, + 'firstname' => false, + 'lastname' => false, + 'name' => false, + 'picture' => true, + 'badges' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'type' => 'type', + 'product' => 'product', + 'username' => 'username', + 'printable_name' => 'printableName', + 'firstname' => 'firstname', + 'lastname' => 'lastname', + 'name' => 'name', + 'picture' => 'picture', + 'badges' => 'badges' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'type' => 'setType', + 'product' => 'setProduct', + 'username' => 'setUsername', + 'printable_name' => 'setPrintableName', + 'firstname' => 'setFirstname', + 'lastname' => 'setLastname', + 'name' => 'setName', + 'picture' => 'setPicture', + 'badges' => 'setBadges' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'type' => 'getType', + 'product' => 'getProduct', + 'username' => 'getUsername', + 'printable_name' => 'getPrintableName', + 'firstname' => 'getFirstname', + 'lastname' => 'getLastname', + 'name' => 'getName', + 'picture' => 'getPicture', + 'badges' => 'getBadges' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const TYPE_USER = 'user'; + public const TYPE_GUEST = 'guest'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getTypeAllowableValues() + { + return [ + self::TYPE_USER, + self::TYPE_GUEST, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('product', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('printable_name', $data ?? [], null); + $this->setIfExists('firstname', $data ?? [], null); + $this->setIfExists('lastname', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('picture', $data ?? [], null); + $this->setIfExists('badges', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + $allowedValues = self::getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['product'] === null) { + $invalidProperties[] = "'product' can't be null"; + } + if ($this->container['username'] === null) { + $invalidProperties[] = "'username' can't be null"; + } + if ($this->container['picture'] === null && !$this->isNullableSetToNull('picture')) { + $invalidProperties[] = "'picture' is required"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The user unique identifier + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string + */ + public function getType(): string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type The type of user account + * + * @return $this + */ + public function setType(string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = self::getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets product + * + * @return \Flat\APIClient\Model\TutteoProduct + */ + public function getProduct(): \Flat\APIClient\Model\TutteoProduct + { + return $this->container['product']; + } + + /** + * Sets product + * + * @param \Flat\APIClient\Model\TutteoProduct $product product + * + * @return $this + */ + public function setProduct(\Flat\APIClient\Model\TutteoProduct $product): static + { + if (is_null($product)) { + throw new InvalidArgumentException('non-nullable product cannot be null'); + } + $this->container['product'] = $product; + + return $this; + } + + /** + * Gets username + * + * @return string + */ + public function getUsername(): string + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string $username The user name (unique for the organization) + * + * @return $this + */ + public function setUsername(string $username): static + { + if (is_null($username)) { + throw new InvalidArgumentException('non-nullable username cannot be null'); + } + $this->container['username'] = $username; + + return $this; + } + + /** + * Gets printable_name + * + * @return string|null + */ + public function getPrintableName(): ?string + { + return $this->container['printable_name']; + } + + /** + * Sets printable_name + * + * @param string|null $printable_name The name that can be directly printed (name, firstname & lastname, or username) + * + * @return $this + */ + public function setPrintableName(?string $printable_name): static + { + if (is_null($printable_name)) { + throw new InvalidArgumentException('non-nullable printable_name cannot be null'); + } + $this->container['printable_name'] = $printable_name; + + return $this; + } + + /** + * Gets firstname + * + * @return string|null + */ + public function getFirstname(): ?string + { + return $this->container['firstname']; + } + + /** + * Sets firstname + * + * @param string|null $firstname Firstname of the user (for education users) + * + * @return $this + */ + public function setFirstname(?string $firstname): static + { + if (is_null($firstname)) { + throw new InvalidArgumentException('non-nullable firstname cannot be null'); + } + $this->container['firstname'] = $firstname; + + return $this; + } + + /** + * Gets lastname + * + * @return string|null + */ + public function getLastname(): ?string + { + return $this->container['lastname']; + } + + /** + * Sets lastname + * + * @param string|null $lastname Lastname of the user (for education users) + * + * @return $this + */ + public function setLastname(?string $lastname): static + { + if (is_null($lastname)) { + throw new InvalidArgumentException('non-nullable lastname cannot be null'); + } + $this->container['lastname'] = $lastname; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name A displayable name for the user (for consumer users) + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets picture + * + * @return string|null + */ + public function getPicture(): ?string + { + return $this->container['picture']; + } + + /** + * Sets picture + * + * @param string|null $picture The URL of the picture to display + * + * @return $this + */ + public function setPicture(?string $picture): static + { + if (is_null($picture)) { + array_push($this->openAPINullablesSetToNull, 'picture'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('picture', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['picture'] = $picture; + + return $this; + } + + /** + * Gets badges + * + * @return string[]|null + */ + public function getBadges(): ?array + { + return $this->container['badges']; + } + + /** + * Sets badges + * + * @param string[]|null $badges List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` + * + * @return $this + */ + public function setBadges(?array $badges): static + { + if (is_null($badges)) { + throw new InvalidArgumentException('non-nullable badges cannot be null'); + } + $this->container['badges'] = $badges; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/UserCommunityProfileLinks.php b/src/Model/UserCommunityProfileLinks.php new file mode 100644 index 0000000..6544b2b --- /dev/null +++ b/src/Model/UserCommunityProfileLinks.php @@ -0,0 +1,597 @@ + + */ +class UserCommunityProfileLinks implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'UserCommunityProfileLinks'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'spotify_url' => 'string', + 'youtube_url' => 'string', + 'soundcloud_url' => 'string', + 'tiktok_url' => 'string', + 'instagram_url' => 'string', + 'website_url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'spotify_url' => null, + 'youtube_url' => null, + 'soundcloud_url' => null, + 'tiktok_url' => null, + 'instagram_url' => null, + 'website_url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'spotify_url' => true, + 'youtube_url' => true, + 'soundcloud_url' => true, + 'tiktok_url' => true, + 'instagram_url' => true, + 'website_url' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'spotify_url' => 'spotifyUrl', + 'youtube_url' => 'youtubeUrl', + 'soundcloud_url' => 'soundcloudUrl', + 'tiktok_url' => 'tiktokUrl', + 'instagram_url' => 'instagramUrl', + 'website_url' => 'websiteUrl' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'spotify_url' => 'setSpotifyUrl', + 'youtube_url' => 'setYoutubeUrl', + 'soundcloud_url' => 'setSoundcloudUrl', + 'tiktok_url' => 'setTiktokUrl', + 'instagram_url' => 'setInstagramUrl', + 'website_url' => 'setWebsiteUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'spotify_url' => 'getSpotifyUrl', + 'youtube_url' => 'getYoutubeUrl', + 'soundcloud_url' => 'getSoundcloudUrl', + 'tiktok_url' => 'getTiktokUrl', + 'instagram_url' => 'getInstagramUrl', + 'website_url' => 'getWebsiteUrl' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('spotify_url', $data ?? [], null); + $this->setIfExists('youtube_url', $data ?? [], null); + $this->setIfExists('soundcloud_url', $data ?? [], null); + $this->setIfExists('tiktok_url', $data ?? [], null); + $this->setIfExists('instagram_url', $data ?? [], null); + $this->setIfExists('website_url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets spotify_url + * + * @return string|null + */ + public function getSpotifyUrl(): ?string + { + return $this->container['spotify_url']; + } + + /** + * Sets spotify_url + * + * @param string|null $spotify_url Spotify Profile URL + * + * @return $this + */ + public function setSpotifyUrl(?string $spotify_url): static + { + if (is_null($spotify_url)) { + array_push($this->openAPINullablesSetToNull, 'spotify_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('spotify_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['spotify_url'] = $spotify_url; + + return $this; + } + + /** + * Gets youtube_url + * + * @return string|null + */ + public function getYoutubeUrl(): ?string + { + return $this->container['youtube_url']; + } + + /** + * Sets youtube_url + * + * @param string|null $youtube_url YouTube channel URL + * + * @return $this + */ + public function setYoutubeUrl(?string $youtube_url): static + { + if (is_null($youtube_url)) { + array_push($this->openAPINullablesSetToNull, 'youtube_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('youtube_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['youtube_url'] = $youtube_url; + + return $this; + } + + /** + * Gets soundcloud_url + * + * @return string|null + */ + public function getSoundcloudUrl(): ?string + { + return $this->container['soundcloud_url']; + } + + /** + * Sets soundcloud_url + * + * @param string|null $soundcloud_url SoundCloud Profile URL + * + * @return $this + */ + public function setSoundcloudUrl(?string $soundcloud_url): static + { + if (is_null($soundcloud_url)) { + array_push($this->openAPINullablesSetToNull, 'soundcloud_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('soundcloud_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['soundcloud_url'] = $soundcloud_url; + + return $this; + } + + /** + * Gets tiktok_url + * + * @return string|null + */ + public function getTiktokUrl(): ?string + { + return $this->container['tiktok_url']; + } + + /** + * Sets tiktok_url + * + * @param string|null $tiktok_url TikTok profile URL. For updates, also accepts TikTok usernames + * + * @return $this + */ + public function setTiktokUrl(?string $tiktok_url): static + { + if (is_null($tiktok_url)) { + array_push($this->openAPINullablesSetToNull, 'tiktok_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tiktok_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tiktok_url'] = $tiktok_url; + + return $this; + } + + /** + * Gets instagram_url + * + * @return string|null + */ + public function getInstagramUrl(): ?string + { + return $this->container['instagram_url']; + } + + /** + * Sets instagram_url + * + * @param string|null $instagram_url Instagram profile URL. For updates, also accepts Instagram usernames + * + * @return $this + */ + public function setInstagramUrl(?string $instagram_url): static + { + if (is_null($instagram_url)) { + array_push($this->openAPINullablesSetToNull, 'instagram_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('instagram_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['instagram_url'] = $instagram_url; + + return $this; + } + + /** + * Gets website_url + * + * @return string|null + */ + public function getWebsiteUrl(): ?string + { + return $this->container['website_url']; + } + + /** + * Sets website_url + * + * @param string|null $website_url Personnal website URL + * + * @return $this + */ + public function setWebsiteUrl(?string $website_url): static + { + if (is_null($website_url)) { + array_push($this->openAPINullablesSetToNull, 'website_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('website_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['website_url'] = $website_url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/UserCreation.php b/src/Model/UserCreation.php new file mode 100644 index 0000000..370b79c --- /dev/null +++ b/src/Model/UserCreation.php @@ -0,0 +1,679 @@ + + */ +class UserCreation implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'UserCreation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'username' => 'string', + 'firstname' => 'string', + 'lastname' => 'string', + 'email' => 'string', + 'password' => 'string', + 'locale' => 'string', + 'role' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'username' => null, + 'firstname' => null, + 'lastname' => null, + 'email' => 'email', + 'password' => 'password', + 'locale' => null, + 'role' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'username' => false, + 'firstname' => false, + 'lastname' => false, + 'email' => false, + 'password' => false, + 'locale' => false, + 'role' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'username' => 'username', + 'firstname' => 'firstname', + 'lastname' => 'lastname', + 'email' => 'email', + 'password' => 'password', + 'locale' => 'locale', + 'role' => 'role' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'username' => 'setUsername', + 'firstname' => 'setFirstname', + 'lastname' => 'setLastname', + 'email' => 'setEmail', + 'password' => 'setPassword', + 'locale' => 'setLocale', + 'role' => 'setRole' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'username' => 'getUsername', + 'firstname' => 'getFirstname', + 'lastname' => 'getLastname', + 'email' => 'getEmail', + 'password' => 'getPassword', + 'locale' => 'getLocale', + 'role' => 'getRole' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const ROLE_USER = 'user'; + public const ROLE_TEACHER = 'teacher'; + public const ROLE_ADMIN = 'admin'; + public const ROLE_ACCOUNT_ADMIN = 'accountAdmin'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getRoleAllowableValues() + { + return [ + self::ROLE_USER, + self::ROLE_TEACHER, + self::ROLE_ADMIN, + self::ROLE_ACCOUNT_ADMIN, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('firstname', $data ?? [], null); + $this->setIfExists('lastname', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('password', $data ?? [], null); + $this->setIfExists('locale', $data ?? [], 'en'); + $this->setIfExists('role', $data ?? [], 'user'); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['username'] === null) { + $invalidProperties[] = "'username' can't be null"; + } + if ((mb_strlen($this->container['username']) > 30)) { + $invalidProperties[] = "invalid value for 'username', the character length must be smaller than or equal to 30."; + } + + if ((mb_strlen($this->container['username']) < 1)) { + $invalidProperties[] = "invalid value for 'username', the character length must be bigger than or equal to 1."; + } + + if (!is_null($this->container['firstname']) && (mb_strlen($this->container['firstname']) > 60)) { + $invalidProperties[] = "invalid value for 'firstname', the character length must be smaller than or equal to 60."; + } + + if (!is_null($this->container['lastname']) && (mb_strlen($this->container['lastname']) > 60)) { + $invalidProperties[] = "invalid value for 'lastname', the character length must be smaller than or equal to 60."; + } + + if ($this->container['password'] === null) { + $invalidProperties[] = "'password' can't be null"; + } + if ((mb_strlen($this->container['password']) > 1000)) { + $invalidProperties[] = "invalid value for 'password', the character length must be smaller than or equal to 1000."; + } + + if ((mb_strlen($this->container['password']) < 6)) { + $invalidProperties[] = "invalid value for 'password', the character length must be bigger than or equal to 6."; + } + + $allowedValues = self::getRoleAllowableValues(); + if (!is_null($this->container['role']) && !in_array($this->container['role'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'role', must be one of '%s'", + $this->container['role'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets username + * + * @return string + */ + public function getUsername(): string + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string $username Username of the new account + * + * @return $this + */ + public function setUsername(string $username): static + { + if (is_null($username)) { + throw new InvalidArgumentException('non-nullable username cannot be null'); + } + if ((mb_strlen($username) > 30)) { + throw new InvalidArgumentException('invalid length for $username when calling UserCreation., must be smaller than or equal to 30.'); + } + if ((mb_strlen($username) < 1)) { + throw new InvalidArgumentException('invalid length for $username when calling UserCreation., must be bigger than or equal to 1.'); + } + + $this->container['username'] = $username; + + return $this; + } + + /** + * Gets firstname + * + * @return string|null + */ + public function getFirstname(): ?string + { + return $this->container['firstname']; + } + + /** + * Sets firstname + * + * @param string|null $firstname First name of the user + * + * @return $this + */ + public function setFirstname(?string $firstname): static + { + if (is_null($firstname)) { + throw new InvalidArgumentException('non-nullable firstname cannot be null'); + } + if ((mb_strlen($firstname) > 60)) { + throw new InvalidArgumentException('invalid length for $firstname when calling UserCreation., must be smaller than or equal to 60.'); + } + + $this->container['firstname'] = $firstname; + + return $this; + } + + /** + * Gets lastname + * + * @return string|null + */ + public function getLastname(): ?string + { + return $this->container['lastname']; + } + + /** + * Sets lastname + * + * @param string|null $lastname Last name of the user + * + * @return $this + */ + public function setLastname(?string $lastname): static + { + if (is_null($lastname)) { + throw new InvalidArgumentException('non-nullable lastname cannot be null'); + } + if ((mb_strlen($lastname) > 60)) { + throw new InvalidArgumentException('invalid length for $lastname when calling UserCreation., must be smaller than or equal to 60.'); + } + + $this->container['lastname'] = $lastname; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail(): ?string + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Email of the new account + * + * @return $this + */ + public function setEmail(?string $email): static + { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets password + * + * @return string + */ + public function getPassword(): string + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string $password Password of the new account + * + * @return $this + */ + public function setPassword(string $password): static + { + if (is_null($password)) { + throw new InvalidArgumentException('non-nullable password cannot be null'); + } + if ((mb_strlen($password) > 1000)) { + throw new InvalidArgumentException('invalid length for $password when calling UserCreation., must be smaller than or equal to 1000.'); + } + if ((mb_strlen($password) < 6)) { + throw new InvalidArgumentException('invalid length for $password when calling UserCreation., must be bigger than or equal to 6.'); + } + + $this->container['password'] = $password; + + return $this; + } + + /** + * Gets locale + * + * @return string|null + */ + public function getLocale(): ?string + { + return $this->container['locale']; + } + + /** + * Sets locale + * + * @param string|null $locale User language. Input values will be automatically normalized to a supported locale code. + * + * @return $this + */ + public function setLocale(?string $locale): static + { + if (is_null($locale)) { + throw new InvalidArgumentException('non-nullable locale cannot be null'); + } + $this->container['locale'] = $locale; + + return $this; + } + + /** + * Gets role + * + * @return string|null + */ + public function getRole(): ?string + { + return $this->container['role']; + } + + /** + * Sets role + * + * @param string|null $role Role of the new account + * + * @return $this + */ + public function setRole(?string $role): static + { + if (is_null($role)) { + throw new InvalidArgumentException('non-nullable role cannot be null'); + } + $allowedValues = self::getRoleAllowableValues(); + if (!in_array($role, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'role', must be one of '%s'", + $role, + implode("', '", $allowedValues) + ) + ); + } + $this->container['role'] = $role; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/UserDetails.php b/src/Model/UserDetails.php new file mode 100644 index 0000000..9fe8384 --- /dev/null +++ b/src/Model/UserDetails.php @@ -0,0 +1,1536 @@ + + */ +class UserDetails implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'UserDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'type' => 'string', + 'product' => '\Flat\APIClient\Model\TutteoProduct', + 'username' => 'string', + 'printable_name' => 'string', + 'firstname' => 'string', + 'lastname' => 'string', + 'name' => 'string', + 'picture' => 'string', + 'badges' => 'string[]', + 'organization' => 'string', + 'organization_role' => '\Flat\APIClient\Model\OrganizationRoles', + 'class_role' => '\Flat\APIClient\Model\ClassRoles', + 'html_url' => 'string', + 'bio' => 'string', + 'registration_date' => '\DateTime', + 'liked_scores_count' => 'int', + 'followers_count' => 'int', + 'following_count' => 'int', + 'owned_public_scores_count' => 'int', + 'all_public_scores_count' => 'int', + 'likes_count' => 'int', + 'plays_count' => 'int', + 'cover_picture' => 'string', + 'profile_theme' => 'string', + 'links' => '\Flat\APIClient\Model\UserCommunityProfileLinks', + 'is_email_verified' => 'bool', + 'azure_details' => '\Flat\APIClient\Model\UserAzureDetails', + 'private_profile' => 'bool', + 'locale' => 'string', + 'groups' => 'string[]', + 'picture_file' => 'string', + 'cover_picture_file' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'type' => null, + 'product' => null, + 'username' => null, + 'printable_name' => null, + 'firstname' => null, + 'lastname' => null, + 'name' => null, + 'picture' => null, + 'badges' => null, + 'organization' => null, + 'organization_role' => null, + 'class_role' => null, + 'html_url' => null, + 'bio' => null, + 'registration_date' => 'date-time', + 'liked_scores_count' => null, + 'followers_count' => null, + 'following_count' => null, + 'owned_public_scores_count' => null, + 'all_public_scores_count' => null, + 'likes_count' => null, + 'plays_count' => null, + 'cover_picture' => null, + 'profile_theme' => null, + 'links' => null, + 'is_email_verified' => null, + 'azure_details' => null, + 'private_profile' => null, + 'locale' => null, + 'groups' => null, + 'picture_file' => null, + 'cover_picture_file' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'type' => false, + 'product' => false, + 'username' => false, + 'printable_name' => false, + 'firstname' => false, + 'lastname' => false, + 'name' => false, + 'picture' => false, + 'badges' => false, + 'organization' => false, + 'organization_role' => false, + 'class_role' => false, + 'html_url' => false, + 'bio' => false, + 'registration_date' => false, + 'liked_scores_count' => false, + 'followers_count' => false, + 'following_count' => false, + 'owned_public_scores_count' => false, + 'all_public_scores_count' => false, + 'likes_count' => false, + 'plays_count' => false, + 'cover_picture' => false, + 'profile_theme' => false, + 'links' => false, + 'is_email_verified' => false, + 'azure_details' => false, + 'private_profile' => false, + 'locale' => false, + 'groups' => false, + 'picture_file' => true, + 'cover_picture_file' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'type' => 'type', + 'product' => 'product', + 'username' => 'username', + 'printable_name' => 'printableName', + 'firstname' => 'firstname', + 'lastname' => 'lastname', + 'name' => 'name', + 'picture' => 'picture', + 'badges' => 'badges', + 'organization' => 'organization', + 'organization_role' => 'organizationRole', + 'class_role' => 'classRole', + 'html_url' => 'htmlUrl', + 'bio' => 'bio', + 'registration_date' => 'registrationDate', + 'liked_scores_count' => 'likedScoresCount', + 'followers_count' => 'followersCount', + 'following_count' => 'followingCount', + 'owned_public_scores_count' => 'ownedPublicScoresCount', + 'all_public_scores_count' => 'allPublicScoresCount', + 'likes_count' => 'likesCount', + 'plays_count' => 'playsCount', + 'cover_picture' => 'coverPicture', + 'profile_theme' => 'profileTheme', + 'links' => 'links', + 'is_email_verified' => 'isEmailVerified', + 'azure_details' => 'azureDetails', + 'private_profile' => 'privateProfile', + 'locale' => 'locale', + 'groups' => 'groups', + 'picture_file' => 'pictureFile', + 'cover_picture_file' => 'coverPictureFile' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'type' => 'setType', + 'product' => 'setProduct', + 'username' => 'setUsername', + 'printable_name' => 'setPrintableName', + 'firstname' => 'setFirstname', + 'lastname' => 'setLastname', + 'name' => 'setName', + 'picture' => 'setPicture', + 'badges' => 'setBadges', + 'organization' => 'setOrganization', + 'organization_role' => 'setOrganizationRole', + 'class_role' => 'setClassRole', + 'html_url' => 'setHtmlUrl', + 'bio' => 'setBio', + 'registration_date' => 'setRegistrationDate', + 'liked_scores_count' => 'setLikedScoresCount', + 'followers_count' => 'setFollowersCount', + 'following_count' => 'setFollowingCount', + 'owned_public_scores_count' => 'setOwnedPublicScoresCount', + 'all_public_scores_count' => 'setAllPublicScoresCount', + 'likes_count' => 'setLikesCount', + 'plays_count' => 'setPlaysCount', + 'cover_picture' => 'setCoverPicture', + 'profile_theme' => 'setProfileTheme', + 'links' => 'setLinks', + 'is_email_verified' => 'setIsEmailVerified', + 'azure_details' => 'setAzureDetails', + 'private_profile' => 'setPrivateProfile', + 'locale' => 'setLocale', + 'groups' => 'setGroups', + 'picture_file' => 'setPictureFile', + 'cover_picture_file' => 'setCoverPictureFile' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'type' => 'getType', + 'product' => 'getProduct', + 'username' => 'getUsername', + 'printable_name' => 'getPrintableName', + 'firstname' => 'getFirstname', + 'lastname' => 'getLastname', + 'name' => 'getName', + 'picture' => 'getPicture', + 'badges' => 'getBadges', + 'organization' => 'getOrganization', + 'organization_role' => 'getOrganizationRole', + 'class_role' => 'getClassRole', + 'html_url' => 'getHtmlUrl', + 'bio' => 'getBio', + 'registration_date' => 'getRegistrationDate', + 'liked_scores_count' => 'getLikedScoresCount', + 'followers_count' => 'getFollowersCount', + 'following_count' => 'getFollowingCount', + 'owned_public_scores_count' => 'getOwnedPublicScoresCount', + 'all_public_scores_count' => 'getAllPublicScoresCount', + 'likes_count' => 'getLikesCount', + 'plays_count' => 'getPlaysCount', + 'cover_picture' => 'getCoverPicture', + 'profile_theme' => 'getProfileTheme', + 'links' => 'getLinks', + 'is_email_verified' => 'getIsEmailVerified', + 'azure_details' => 'getAzureDetails', + 'private_profile' => 'getPrivateProfile', + 'locale' => 'getLocale', + 'groups' => 'getGroups', + 'picture_file' => 'getPictureFile', + 'cover_picture_file' => 'getCoverPictureFile' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const TYPE_USER = 'user'; + public const TYPE_GUEST = 'guest'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getTypeAllowableValues() + { + return [ + self::TYPE_USER, + self::TYPE_GUEST, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('product', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('printable_name', $data ?? [], null); + $this->setIfExists('firstname', $data ?? [], null); + $this->setIfExists('lastname', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('picture', $data ?? [], null); + $this->setIfExists('badges', $data ?? [], null); + $this->setIfExists('organization', $data ?? [], null); + $this->setIfExists('organization_role', $data ?? [], null); + $this->setIfExists('class_role', $data ?? [], null); + $this->setIfExists('html_url', $data ?? [], null); + $this->setIfExists('bio', $data ?? [], null); + $this->setIfExists('registration_date', $data ?? [], null); + $this->setIfExists('liked_scores_count', $data ?? [], null); + $this->setIfExists('followers_count', $data ?? [], null); + $this->setIfExists('following_count', $data ?? [], null); + $this->setIfExists('owned_public_scores_count', $data ?? [], null); + $this->setIfExists('all_public_scores_count', $data ?? [], null); + $this->setIfExists('likes_count', $data ?? [], null); + $this->setIfExists('plays_count', $data ?? [], null); + $this->setIfExists('cover_picture', $data ?? [], null); + $this->setIfExists('profile_theme', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('is_email_verified', $data ?? [], null); + $this->setIfExists('azure_details', $data ?? [], null); + $this->setIfExists('private_profile', $data ?? [], null); + $this->setIfExists('locale', $data ?? [], 'en'); + $this->setIfExists('groups', $data ?? [], null); + $this->setIfExists('picture_file', $data ?? [], null); + $this->setIfExists('cover_picture_file', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + $allowedValues = self::getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['product'] === null) { + $invalidProperties[] = "'product' can't be null"; + } + if ($this->container['username'] === null) { + $invalidProperties[] = "'username' can't be null"; + } + if ($this->container['picture'] === null) { + $invalidProperties[] = "'picture' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The user unique identifier + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string + */ + public function getType(): string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type The type of user account + * + * @return $this + */ + public function setType(string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = self::getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets product + * + * @return \Flat\APIClient\Model\TutteoProduct + */ + public function getProduct(): \Flat\APIClient\Model\TutteoProduct + { + return $this->container['product']; + } + + /** + * Sets product + * + * @param \Flat\APIClient\Model\TutteoProduct $product product + * + * @return $this + */ + public function setProduct(\Flat\APIClient\Model\TutteoProduct $product): static + { + if (is_null($product)) { + throw new InvalidArgumentException('non-nullable product cannot be null'); + } + $this->container['product'] = $product; + + return $this; + } + + /** + * Gets username + * + * @return string + */ + public function getUsername(): string + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string $username The user name (unique for the organization) + * + * @return $this + */ + public function setUsername(string $username): static + { + if (is_null($username)) { + throw new InvalidArgumentException('non-nullable username cannot be null'); + } + $this->container['username'] = $username; + + return $this; + } + + /** + * Gets printable_name + * + * @return string|null + */ + public function getPrintableName(): ?string + { + return $this->container['printable_name']; + } + + /** + * Sets printable_name + * + * @param string|null $printable_name The name that can be directly printed (name, firstname & lastname, or username) + * + * @return $this + */ + public function setPrintableName(?string $printable_name): static + { + if (is_null($printable_name)) { + throw new InvalidArgumentException('non-nullable printable_name cannot be null'); + } + $this->container['printable_name'] = $printable_name; + + return $this; + } + + /** + * Gets firstname + * + * @return string|null + */ + public function getFirstname(): ?string + { + return $this->container['firstname']; + } + + /** + * Sets firstname + * + * @param string|null $firstname Firstname of the user (for education users) + * + * @return $this + */ + public function setFirstname(?string $firstname): static + { + if (is_null($firstname)) { + throw new InvalidArgumentException('non-nullable firstname cannot be null'); + } + $this->container['firstname'] = $firstname; + + return $this; + } + + /** + * Gets lastname + * + * @return string|null + */ + public function getLastname(): ?string + { + return $this->container['lastname']; + } + + /** + * Sets lastname + * + * @param string|null $lastname Lastname of the user (for education users) + * + * @return $this + */ + public function setLastname(?string $lastname): static + { + if (is_null($lastname)) { + throw new InvalidArgumentException('non-nullable lastname cannot be null'); + } + $this->container['lastname'] = $lastname; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name A displayable name for the user (for consumer users) + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets picture + * + * @return string + */ + public function getPicture(): string + { + return $this->container['picture']; + } + + /** + * Sets picture + * + * @param string $picture The URL of the picture to display + * + * @return $this + */ + public function setPicture(string $picture): static + { + if (is_null($picture)) { + throw new InvalidArgumentException('non-nullable picture cannot be null'); + } + $this->container['picture'] = $picture; + + return $this; + } + + /** + * Gets badges + * + * @return string[]|null + */ + public function getBadges(): ?array + { + return $this->container['badges']; + } + + /** + * Sets badges + * + * @param string[]|null $badges List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` + * + * @return $this + */ + public function setBadges(?array $badges): static + { + if (is_null($badges)) { + throw new InvalidArgumentException('non-nullable badges cannot be null'); + } + $this->container['badges'] = $badges; + + return $this; + } + + /** + * Gets organization + * + * @return string|null + */ + public function getOrganization(): ?string + { + return $this->container['organization']; + } + + /** + * Sets organization + * + * @param string|null $organization Organization ID (for Edu users only) + * + * @return $this + */ + public function setOrganization(?string $organization): static + { + if (is_null($organization)) { + throw new InvalidArgumentException('non-nullable organization cannot be null'); + } + $this->container['organization'] = $organization; + + return $this; + } + + /** + * Gets organization_role + * + * @return \Flat\APIClient\Model\OrganizationRoles|null + */ + public function getOrganizationRole(): ?\Flat\APIClient\Model\OrganizationRoles + { + return $this->container['organization_role']; + } + + /** + * Sets organization_role + * + * @param \Flat\APIClient\Model\OrganizationRoles|null $organization_role organization_role + * + * @return $this + */ + public function setOrganizationRole(?\Flat\APIClient\Model\OrganizationRoles $organization_role): static + { + if (is_null($organization_role)) { + throw new InvalidArgumentException('non-nullable organization_role cannot be null'); + } + $this->container['organization_role'] = $organization_role; + + return $this; + } + + /** + * Gets class_role + * + * @return \Flat\APIClient\Model\ClassRoles|null + */ + public function getClassRole(): ?\Flat\APIClient\Model\ClassRoles + { + return $this->container['class_role']; + } + + /** + * Sets class_role + * + * @param \Flat\APIClient\Model\ClassRoles|null $class_role class_role + * + * @return $this + */ + public function setClassRole(?\Flat\APIClient\Model\ClassRoles $class_role): static + { + if (is_null($class_role)) { + throw new InvalidArgumentException('non-nullable class_role cannot be null'); + } + $this->container['class_role'] = $class_role; + + return $this; + } + + /** + * Gets html_url + * + * @return string|null + */ + public function getHtmlUrl(): ?string + { + return $this->container['html_url']; + } + + /** + * Sets html_url + * + * @param string|null $html_url Link to user profile (for Indiv. users only) + * + * @return $this + */ + public function setHtmlUrl(?string $html_url): static + { + if (is_null($html_url)) { + throw new InvalidArgumentException('non-nullable html_url cannot be null'); + } + $this->container['html_url'] = $html_url; + + return $this; + } + + /** + * Gets bio + * + * @return string|null + */ + public function getBio(): ?string + { + return $this->container['bio']; + } + + /** + * Sets bio + * + * @param string|null $bio User's biography + * + * @return $this + */ + public function setBio(?string $bio): static + { + if (is_null($bio)) { + throw new InvalidArgumentException('non-nullable bio cannot be null'); + } + $this->container['bio'] = $bio; + + return $this; + } + + /** + * Gets registration_date + * + * @return \DateTime|null + */ + public function getRegistrationDate(): ?\DateTime + { + return $this->container['registration_date']; + } + + /** + * Sets registration_date + * + * @param \DateTime|null $registration_date Date the user signed up + * + * @return $this + */ + public function setRegistrationDate(?\DateTime $registration_date): static + { + if (is_null($registration_date)) { + throw new InvalidArgumentException('non-nullable registration_date cannot be null'); + } + $this->container['registration_date'] = $registration_date; + + return $this; + } + + /** + * Gets liked_scores_count + * + * @return int|null + */ + public function getLikedScoresCount(): ?int + { + return $this->container['liked_scores_count']; + } + + /** + * Sets liked_scores_count + * + * @param int|null $liked_scores_count Number of the scores liked by the user + * + * @return $this + */ + public function setLikedScoresCount(?int $liked_scores_count): static + { + if (is_null($liked_scores_count)) { + throw new InvalidArgumentException('non-nullable liked_scores_count cannot be null'); + } + $this->container['liked_scores_count'] = $liked_scores_count; + + return $this; + } + + /** + * Gets followers_count + * + * @return int|null + */ + public function getFollowersCount(): ?int + { + return $this->container['followers_count']; + } + + /** + * Sets followers_count + * + * @param int|null $followers_count Number of followers the user have + * + * @return $this + */ + public function setFollowersCount(?int $followers_count): static + { + if (is_null($followers_count)) { + throw new InvalidArgumentException('non-nullable followers_count cannot be null'); + } + $this->container['followers_count'] = $followers_count; + + return $this; + } + + /** + * Gets following_count + * + * @return int|null + */ + public function getFollowingCount(): ?int + { + return $this->container['following_count']; + } + + /** + * Sets following_count + * + * @param int|null $following_count Number of people the user follow + * + * @return $this + */ + public function setFollowingCount(?int $following_count): static + { + if (is_null($following_count)) { + throw new InvalidArgumentException('non-nullable following_count cannot be null'); + } + $this->container['following_count'] = $following_count; + + return $this; + } + + /** + * Gets owned_public_scores_count + * + * @return int|null + */ + public function getOwnedPublicScoresCount(): ?int + { + return $this->container['owned_public_scores_count']; + } + + /** + * Sets owned_public_scores_count + * + * @param int|null $owned_public_scores_count Number of public scores the user have + * + * @return $this + */ + public function setOwnedPublicScoresCount(?int $owned_public_scores_count): static + { + if (is_null($owned_public_scores_count)) { + throw new InvalidArgumentException('non-nullable owned_public_scores_count cannot be null'); + } + $this->container['owned_public_scores_count'] = $owned_public_scores_count; + + return $this; + } + + /** + * Gets all_public_scores_count + * + * @return int|null + */ + public function getAllPublicScoresCount(): ?int + { + return $this->container['all_public_scores_count']; + } + + /** + * Sets all_public_scores_count + * + * @param int|null $all_public_scores_count Total number of public scores the user participates in (owned + joined) + * + * @return $this + */ + public function setAllPublicScoresCount(?int $all_public_scores_count): static + { + if (is_null($all_public_scores_count)) { + throw new InvalidArgumentException('non-nullable all_public_scores_count cannot be null'); + } + $this->container['all_public_scores_count'] = $all_public_scores_count; + + return $this; + } + + /** + * Gets likes_count + * + * @return int|null + */ + public function getLikesCount(): ?int + { + return $this->container['likes_count']; + } + + /** + * Sets likes_count + * + * @param int|null $likes_count Number of likes on the user published scores + * + * @return $this + */ + public function setLikesCount(?int $likes_count): static + { + if (is_null($likes_count)) { + throw new InvalidArgumentException('non-nullable likes_count cannot be null'); + } + $this->container['likes_count'] = $likes_count; + + return $this; + } + + /** + * Gets plays_count + * + * @return int|null + */ + public function getPlaysCount(): ?int + { + return $this->container['plays_count']; + } + + /** + * Sets plays_count + * + * @param int|null $plays_count Number of plays on the user published scores + * + * @return $this + */ + public function setPlaysCount(?int $plays_count): static + { + if (is_null($plays_count)) { + throw new InvalidArgumentException('non-nullable plays_count cannot be null'); + } + $this->container['plays_count'] = $plays_count; + + return $this; + } + + /** + * Gets cover_picture + * + * @return string|null + */ + public function getCoverPicture(): ?string + { + return $this->container['cover_picture']; + } + + /** + * Sets cover_picture + * + * @param string|null $cover_picture Cover picture (backgroud) for the profile + * + * @return $this + */ + public function setCoverPicture(?string $cover_picture): static + { + if (is_null($cover_picture)) { + throw new InvalidArgumentException('non-nullable cover_picture cannot be null'); + } + $this->container['cover_picture'] = $cover_picture; + + return $this; + } + + /** + * Gets profile_theme + * + * @return string|null + */ + public function getProfileTheme(): ?string + { + return $this->container['profile_theme']; + } + + /** + * Sets profile_theme + * + * @param string|null $profile_theme Theme (background) for the profile + * + * @return $this + */ + public function setProfileTheme(?string $profile_theme): static + { + if (is_null($profile_theme)) { + throw new InvalidArgumentException('non-nullable profile_theme cannot be null'); + } + $this->container['profile_theme'] = $profile_theme; + + return $this; + } + + /** + * Gets links + * + * @return \Flat\APIClient\Model\UserCommunityProfileLinks|null + */ + public function getLinks(): ?\Flat\APIClient\Model\UserCommunityProfileLinks + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param \Flat\APIClient\Model\UserCommunityProfileLinks|null $links links + * + * @return $this + */ + public function setLinks(?\Flat\APIClient\Model\UserCommunityProfileLinks $links): static + { + if (is_null($links)) { + throw new InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets is_email_verified + * + * @return bool|null + */ + public function getIsEmailVerified(): ?bool + { + return $this->container['is_email_verified']; + } + + /** + * Sets is_email_verified + * + * @param bool|null $is_email_verified Whether the user's email address has been verified + * + * @return $this + */ + public function setIsEmailVerified(?bool $is_email_verified): static + { + if (is_null($is_email_verified)) { + throw new InvalidArgumentException('non-nullable is_email_verified cannot be null'); + } + $this->container['is_email_verified'] = $is_email_verified; + + return $this; + } + + /** + * Gets azure_details + * + * @return \Flat\APIClient\Model\UserAzureDetails|null + */ + public function getAzureDetails(): ?\Flat\APIClient\Model\UserAzureDetails + { + return $this->container['azure_details']; + } + + /** + * Sets azure_details + * + * @param \Flat\APIClient\Model\UserAzureDetails|null $azure_details azure_details + * + * @return $this + */ + public function setAzureDetails(?\Flat\APIClient\Model\UserAzureDetails $azure_details): static + { + if (is_null($azure_details)) { + throw new InvalidArgumentException('non-nullable azure_details cannot be null'); + } + $this->container['azure_details'] = $azure_details; + + return $this; + } + + /** + * Gets private_profile + * + * @return bool|null + */ + public function getPrivateProfile(): ?bool + { + return $this->container['private_profile']; + } + + /** + * Sets private_profile + * + * @param bool|null $private_profile Tell either this user profile is private or not (individual accounts only) + * + * @return $this + */ + public function setPrivateProfile(?bool $private_profile): static + { + if (is_null($private_profile)) { + throw new InvalidArgumentException('non-nullable private_profile cannot be null'); + } + $this->container['private_profile'] = $private_profile; + + return $this; + } + + /** + * Gets locale + * + * @return string|null + */ + public function getLocale(): ?string + { + return $this->container['locale']; + } + + /** + * Sets locale + * + * @param string|null $locale The user language. Input values will be automatically normalized to a supported locale code. Unknown locales will default to `en`. Current supported locales include: `da`, `de`, `en`, `en-GB`, `es`, `fi`, `fil`, `fr`, `fr-CA`, `hi`, `id`, `it`, `ja`, `ja-HIRA`, `ko`, `ms`, `nb`, `nl`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sv`, `tr`, `zh-Hans`, `zh-HK`, `zh-TW` + * + * @return $this + */ + public function setLocale(?string $locale): static + { + if (is_null($locale)) { + throw new InvalidArgumentException('non-nullable locale cannot be null'); + } + $this->container['locale'] = $locale; + + return $this; + } + + /** + * Gets groups + * + * @return string[]|null + */ + public function getGroups(): ?array + { + return $this->container['groups']; + } + + /** + * Sets groups + * + * @param string[]|null $groups For Flat for Education accounts, list of Group identifiers the user is part of. + * + * @return $this + */ + public function setGroups(?array $groups): static + { + if (is_null($groups)) { + throw new InvalidArgumentException('non-nullable groups cannot be null'); + } + $this->container['groups'] = $groups; + + return $this; + } + + /** + * Gets picture_file + * + * @return string|null + */ + public function getPictureFile(): ?string + { + return $this->container['picture_file']; + } + + /** + * Sets picture_file + * + * @param string|null $picture_file The ID of the user profile picture + * + * @return $this + */ + public function setPictureFile(?string $picture_file): static + { + if (is_null($picture_file)) { + array_push($this->openAPINullablesSetToNull, 'picture_file'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('picture_file', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['picture_file'] = $picture_file; + + return $this; + } + + /** + * Gets cover_picture_file + * + * @return string|null + */ + public function getCoverPictureFile(): ?string + { + return $this->container['cover_picture_file']; + } + + /** + * Sets cover_picture_file + * + * @param string|null $cover_picture_file The ID of the user profile cover picture + * + * @return $this + */ + public function setCoverPictureFile(?string $cover_picture_file): static + { + if (is_null($cover_picture_file)) { + array_push($this->openAPINullablesSetToNull, 'cover_picture_file'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cover_picture_file', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['cover_picture_file'] = $cover_picture_file; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/UserDetailsAdmin.php b/src/Model/UserDetailsAdmin.php new file mode 100644 index 0000000..3d2a509 --- /dev/null +++ b/src/Model/UserDetailsAdmin.php @@ -0,0 +1,1046 @@ + + */ +class UserDetailsAdmin implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'UserDetailsAdmin'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'type' => 'string', + 'product' => '\Flat\APIClient\Model\TutteoProduct', + 'username' => 'string', + 'printable_name' => 'string', + 'firstname' => 'string', + 'lastname' => 'string', + 'name' => 'string', + 'picture' => 'string', + 'badges' => 'string[]', + 'organization' => 'string', + 'organization_role' => '\Flat\APIClient\Model\OrganizationRoles', + 'class_role' => '\Flat\APIClient\Model\ClassRoles', + 'html_url' => 'string', + 'email' => 'string', + 'last_activity_date' => '\DateTime', + 'license' => '\Flat\APIClient\Model\UserDetailsAdminAllOfLicense', + 'groups' => 'string[]', + 'is_edu_testing_student' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'type' => null, + 'product' => null, + 'username' => null, + 'printable_name' => null, + 'firstname' => null, + 'lastname' => null, + 'name' => null, + 'picture' => null, + 'badges' => null, + 'organization' => null, + 'organization_role' => null, + 'class_role' => null, + 'html_url' => null, + 'email' => 'email', + 'last_activity_date' => 'date-time', + 'license' => null, + 'groups' => null, + 'is_edu_testing_student' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'type' => false, + 'product' => false, + 'username' => false, + 'printable_name' => false, + 'firstname' => false, + 'lastname' => false, + 'name' => false, + 'picture' => false, + 'badges' => false, + 'organization' => false, + 'organization_role' => false, + 'class_role' => false, + 'html_url' => false, + 'email' => false, + 'last_activity_date' => false, + 'license' => false, + 'groups' => false, + 'is_edu_testing_student' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'type' => 'type', + 'product' => 'product', + 'username' => 'username', + 'printable_name' => 'printableName', + 'firstname' => 'firstname', + 'lastname' => 'lastname', + 'name' => 'name', + 'picture' => 'picture', + 'badges' => 'badges', + 'organization' => 'organization', + 'organization_role' => 'organizationRole', + 'class_role' => 'classRole', + 'html_url' => 'htmlUrl', + 'email' => 'email', + 'last_activity_date' => 'lastActivityDate', + 'license' => 'license', + 'groups' => 'groups', + 'is_edu_testing_student' => 'isEduTestingStudent' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'type' => 'setType', + 'product' => 'setProduct', + 'username' => 'setUsername', + 'printable_name' => 'setPrintableName', + 'firstname' => 'setFirstname', + 'lastname' => 'setLastname', + 'name' => 'setName', + 'picture' => 'setPicture', + 'badges' => 'setBadges', + 'organization' => 'setOrganization', + 'organization_role' => 'setOrganizationRole', + 'class_role' => 'setClassRole', + 'html_url' => 'setHtmlUrl', + 'email' => 'setEmail', + 'last_activity_date' => 'setLastActivityDate', + 'license' => 'setLicense', + 'groups' => 'setGroups', + 'is_edu_testing_student' => 'setIsEduTestingStudent' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'type' => 'getType', + 'product' => 'getProduct', + 'username' => 'getUsername', + 'printable_name' => 'getPrintableName', + 'firstname' => 'getFirstname', + 'lastname' => 'getLastname', + 'name' => 'getName', + 'picture' => 'getPicture', + 'badges' => 'getBadges', + 'organization' => 'getOrganization', + 'organization_role' => 'getOrganizationRole', + 'class_role' => 'getClassRole', + 'html_url' => 'getHtmlUrl', + 'email' => 'getEmail', + 'last_activity_date' => 'getLastActivityDate', + 'license' => 'getLicense', + 'groups' => 'getGroups', + 'is_edu_testing_student' => 'getIsEduTestingStudent' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const TYPE_USER = 'user'; + public const TYPE_GUEST = 'guest'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getTypeAllowableValues() + { + return [ + self::TYPE_USER, + self::TYPE_GUEST, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('product', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('printable_name', $data ?? [], null); + $this->setIfExists('firstname', $data ?? [], null); + $this->setIfExists('lastname', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('picture', $data ?? [], null); + $this->setIfExists('badges', $data ?? [], null); + $this->setIfExists('organization', $data ?? [], null); + $this->setIfExists('organization_role', $data ?? [], null); + $this->setIfExists('class_role', $data ?? [], null); + $this->setIfExists('html_url', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('last_activity_date', $data ?? [], null); + $this->setIfExists('license', $data ?? [], null); + $this->setIfExists('groups', $data ?? [], null); + $this->setIfExists('is_edu_testing_student', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + $allowedValues = self::getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['product'] === null) { + $invalidProperties[] = "'product' can't be null"; + } + if ($this->container['username'] === null) { + $invalidProperties[] = "'username' can't be null"; + } + if ($this->container['picture'] === null) { + $invalidProperties[] = "'picture' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The user unique identifier + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string + */ + public function getType(): string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type The type of user account + * + * @return $this + */ + public function setType(string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = self::getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets product + * + * @return \Flat\APIClient\Model\TutteoProduct + */ + public function getProduct(): \Flat\APIClient\Model\TutteoProduct + { + return $this->container['product']; + } + + /** + * Sets product + * + * @param \Flat\APIClient\Model\TutteoProduct $product product + * + * @return $this + */ + public function setProduct(\Flat\APIClient\Model\TutteoProduct $product): static + { + if (is_null($product)) { + throw new InvalidArgumentException('non-nullable product cannot be null'); + } + $this->container['product'] = $product; + + return $this; + } + + /** + * Gets username + * + * @return string + */ + public function getUsername(): string + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string $username The user name (unique for the organization) + * + * @return $this + */ + public function setUsername(string $username): static + { + if (is_null($username)) { + throw new InvalidArgumentException('non-nullable username cannot be null'); + } + $this->container['username'] = $username; + + return $this; + } + + /** + * Gets printable_name + * + * @return string|null + */ + public function getPrintableName(): ?string + { + return $this->container['printable_name']; + } + + /** + * Sets printable_name + * + * @param string|null $printable_name The name that can be directly printed (name, firstname & lastname, or username) + * + * @return $this + */ + public function setPrintableName(?string $printable_name): static + { + if (is_null($printable_name)) { + throw new InvalidArgumentException('non-nullable printable_name cannot be null'); + } + $this->container['printable_name'] = $printable_name; + + return $this; + } + + /** + * Gets firstname + * + * @return string|null + */ + public function getFirstname(): ?string + { + return $this->container['firstname']; + } + + /** + * Sets firstname + * + * @param string|null $firstname Firstname of the user (for education users) + * + * @return $this + */ + public function setFirstname(?string $firstname): static + { + if (is_null($firstname)) { + throw new InvalidArgumentException('non-nullable firstname cannot be null'); + } + $this->container['firstname'] = $firstname; + + return $this; + } + + /** + * Gets lastname + * + * @return string|null + */ + public function getLastname(): ?string + { + return $this->container['lastname']; + } + + /** + * Sets lastname + * + * @param string|null $lastname Lastname of the user (for education users) + * + * @return $this + */ + public function setLastname(?string $lastname): static + { + if (is_null($lastname)) { + throw new InvalidArgumentException('non-nullable lastname cannot be null'); + } + $this->container['lastname'] = $lastname; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name A displayable name for the user (for consumer users) + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets picture + * + * @return string + */ + public function getPicture(): string + { + return $this->container['picture']; + } + + /** + * Sets picture + * + * @param string $picture The URL of the picture to display + * + * @return $this + */ + public function setPicture(string $picture): static + { + if (is_null($picture)) { + throw new InvalidArgumentException('non-nullable picture cannot be null'); + } + $this->container['picture'] = $picture; + + return $this; + } + + /** + * Gets badges + * + * @return string[]|null + */ + public function getBadges(): ?array + { + return $this->container['badges']; + } + + /** + * Sets badges + * + * @param string[]|null $badges List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` + * + * @return $this + */ + public function setBadges(?array $badges): static + { + if (is_null($badges)) { + throw new InvalidArgumentException('non-nullable badges cannot be null'); + } + $this->container['badges'] = $badges; + + return $this; + } + + /** + * Gets organization + * + * @return string|null + */ + public function getOrganization(): ?string + { + return $this->container['organization']; + } + + /** + * Sets organization + * + * @param string|null $organization Organization ID (for Edu users only) + * + * @return $this + */ + public function setOrganization(?string $organization): static + { + if (is_null($organization)) { + throw new InvalidArgumentException('non-nullable organization cannot be null'); + } + $this->container['organization'] = $organization; + + return $this; + } + + /** + * Gets organization_role + * + * @return \Flat\APIClient\Model\OrganizationRoles|null + */ + public function getOrganizationRole(): ?\Flat\APIClient\Model\OrganizationRoles + { + return $this->container['organization_role']; + } + + /** + * Sets organization_role + * + * @param \Flat\APIClient\Model\OrganizationRoles|null $organization_role organization_role + * + * @return $this + */ + public function setOrganizationRole(?\Flat\APIClient\Model\OrganizationRoles $organization_role): static + { + if (is_null($organization_role)) { + throw new InvalidArgumentException('non-nullable organization_role cannot be null'); + } + $this->container['organization_role'] = $organization_role; + + return $this; + } + + /** + * Gets class_role + * + * @return \Flat\APIClient\Model\ClassRoles|null + */ + public function getClassRole(): ?\Flat\APIClient\Model\ClassRoles + { + return $this->container['class_role']; + } + + /** + * Sets class_role + * + * @param \Flat\APIClient\Model\ClassRoles|null $class_role class_role + * + * @return $this + */ + public function setClassRole(?\Flat\APIClient\Model\ClassRoles $class_role): static + { + if (is_null($class_role)) { + throw new InvalidArgumentException('non-nullable class_role cannot be null'); + } + $this->container['class_role'] = $class_role; + + return $this; + } + + /** + * Gets html_url + * + * @return string|null + */ + public function getHtmlUrl(): ?string + { + return $this->container['html_url']; + } + + /** + * Sets html_url + * + * @param string|null $html_url Link to user profile (for Indiv. users only) + * + * @return $this + */ + public function setHtmlUrl(?string $html_url): static + { + if (is_null($html_url)) { + throw new InvalidArgumentException('non-nullable html_url cannot be null'); + } + $this->container['html_url'] = $html_url; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail(): ?string + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Email of the user + * + * @return $this + */ + public function setEmail(?string $email): static + { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets last_activity_date + * + * @return \DateTime|null + */ + public function getLastActivityDate(): ?\DateTime + { + return $this->container['last_activity_date']; + } + + /** + * Sets last_activity_date + * + * @param \DateTime|null $last_activity_date Date of the last user activity + * + * @return $this + */ + public function setLastActivityDate(?\DateTime $last_activity_date): static + { + if (is_null($last_activity_date)) { + throw new InvalidArgumentException('non-nullable last_activity_date cannot be null'); + } + $this->container['last_activity_date'] = $last_activity_date; + + return $this; + } + + /** + * Gets license + * + * @return \Flat\APIClient\Model\UserDetailsAdminAllOfLicense|null + */ + public function getLicense(): ?\Flat\APIClient\Model\UserDetailsAdminAllOfLicense + { + return $this->container['license']; + } + + /** + * Sets license + * + * @param \Flat\APIClient\Model\UserDetailsAdminAllOfLicense|null $license license + * + * @return $this + */ + public function setLicense(?\Flat\APIClient\Model\UserDetailsAdminAllOfLicense $license): static + { + if (is_null($license)) { + throw new InvalidArgumentException('non-nullable license cannot be null'); + } + $this->container['license'] = $license; + + return $this; + } + + /** + * Gets groups + * + * @return string[]|null + */ + public function getGroups(): ?array + { + return $this->container['groups']; + } + + /** + * Sets groups + * + * @param string[]|null $groups For Flat for Education accounts, list of Group identifiers the user is part of. + * + * @return $this + */ + public function setGroups(?array $groups): static + { + if (is_null($groups)) { + throw new InvalidArgumentException('non-nullable groups cannot be null'); + } + $this->container['groups'] = $groups; + + return $this; + } + + /** + * Gets is_edu_testing_student + * + * @return bool|null + */ + public function getIsEduTestingStudent(): ?bool + { + return $this->container['is_edu_testing_student']; + } + + /** + * Sets is_edu_testing_student + * + * @param bool|null $is_edu_testing_student Indicates if the user account is marked as a testing student account. Testing students are typically excluded from certain educational integrations and workflows. This field helps API clients distinguish between regular students and testing accounts. + * + * @return $this + */ + public function setIsEduTestingStudent(?bool $is_edu_testing_student): static + { + if (is_null($is_edu_testing_student)) { + throw new InvalidArgumentException('non-nullable is_edu_testing_student cannot be null'); + } + $this->container['is_edu_testing_student'] = $is_edu_testing_student; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/UserDetailsAdminAllOfLicense.php b/src/Model/UserDetailsAdminAllOfLicense.php new file mode 100644 index 0000000..b33b9fc --- /dev/null +++ b/src/Model/UserDetailsAdminAllOfLicense.php @@ -0,0 +1,521 @@ + + */ +class UserDetailsAdminAllOfLicense implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'UserDetailsAdmin_allOf_license'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'expiration_date' => '\DateTime', + 'source' => '\Flat\APIClient\Model\LicenseSources', + 'mode' => '\Flat\APIClient\Model\LicenseMode', + 'active' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'expiration_date' => 'date-time', + 'source' => null, + 'mode' => null, + 'active' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'expiration_date' => false, + 'source' => false, + 'mode' => false, + 'active' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'expiration_date' => 'expirationDate', + 'source' => 'source', + 'mode' => 'mode', + 'active' => 'active' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'expiration_date' => 'setExpirationDate', + 'source' => 'setSource', + 'mode' => 'setMode', + 'active' => 'setActive' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'expiration_date' => 'getExpirationDate', + 'source' => 'getSource', + 'mode' => 'getMode', + 'active' => 'getActive' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('expiration_date', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('mode', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id ID of the current license + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets expiration_date + * + * @return \DateTime|null + */ + public function getExpirationDate(): ?\DateTime + { + return $this->container['expiration_date']; + } + + /** + * Sets expiration_date + * + * @param \DateTime|null $expiration_date Date when the license expires + * + * @return $this + */ + public function setExpirationDate(?\DateTime $expiration_date): static + { + if (is_null($expiration_date)) { + throw new InvalidArgumentException('non-nullable expiration_date cannot be null'); + } + $this->container['expiration_date'] = $expiration_date; + + return $this; + } + + /** + * Gets source + * + * @return \Flat\APIClient\Model\LicenseSources|null + */ + public function getSource(): ?\Flat\APIClient\Model\LicenseSources + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param \Flat\APIClient\Model\LicenseSources|null $source source + * + * @return $this + */ + public function setSource(?\Flat\APIClient\Model\LicenseSources $source): static + { + if (is_null($source)) { + throw new InvalidArgumentException('non-nullable source cannot be null'); + } + $this->container['source'] = $source; + + return $this; + } + + /** + * Gets mode + * + * @return \Flat\APIClient\Model\LicenseMode|null + */ + public function getMode(): ?\Flat\APIClient\Model\LicenseMode + { + return $this->container['mode']; + } + + /** + * Sets mode + * + * @param \Flat\APIClient\Model\LicenseMode|null $mode mode + * + * @return $this + */ + public function setMode(?\Flat\APIClient\Model\LicenseMode $mode): static + { + if (is_null($mode)) { + throw new InvalidArgumentException('non-nullable mode cannot be null'); + } + $this->container['mode'] = $mode; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive(): ?bool + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active ID of the current license + * + * @return $this + */ + public function setActive(?bool $active): static + { + if (is_null($active)) { + throw new InvalidArgumentException('non-nullable active cannot be null'); + } + $this->container['active'] = $active; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/UserPublic.php b/src/Model/UserPublic.php new file mode 100644 index 0000000..464a233 --- /dev/null +++ b/src/Model/UserPublic.php @@ -0,0 +1,1291 @@ + + */ +class UserPublic implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'UserPublic'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'type' => 'string', + 'product' => '\Flat\APIClient\Model\TutteoProduct', + 'username' => 'string', + 'printable_name' => 'string', + 'firstname' => 'string', + 'lastname' => 'string', + 'name' => 'string', + 'picture' => 'string', + 'badges' => 'string[]', + 'organization' => 'string', + 'organization_role' => '\Flat\APIClient\Model\OrganizationRoles', + 'class_role' => '\Flat\APIClient\Model\ClassRoles', + 'html_url' => 'string', + 'bio' => 'string', + 'registration_date' => '\DateTime', + 'liked_scores_count' => 'int', + 'followers_count' => 'int', + 'following_count' => 'int', + 'owned_public_scores_count' => 'int', + 'all_public_scores_count' => 'int', + 'likes_count' => 'int', + 'plays_count' => 'int', + 'cover_picture' => 'string', + 'profile_theme' => 'string', + 'links' => '\Flat\APIClient\Model\UserCommunityProfileLinks' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'type' => null, + 'product' => null, + 'username' => null, + 'printable_name' => null, + 'firstname' => null, + 'lastname' => null, + 'name' => null, + 'picture' => null, + 'badges' => null, + 'organization' => null, + 'organization_role' => null, + 'class_role' => null, + 'html_url' => null, + 'bio' => null, + 'registration_date' => 'date-time', + 'liked_scores_count' => null, + 'followers_count' => null, + 'following_count' => null, + 'owned_public_scores_count' => null, + 'all_public_scores_count' => null, + 'likes_count' => null, + 'plays_count' => null, + 'cover_picture' => null, + 'profile_theme' => null, + 'links' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'type' => false, + 'product' => false, + 'username' => false, + 'printable_name' => false, + 'firstname' => false, + 'lastname' => false, + 'name' => false, + 'picture' => false, + 'badges' => false, + 'organization' => false, + 'organization_role' => false, + 'class_role' => false, + 'html_url' => false, + 'bio' => false, + 'registration_date' => false, + 'liked_scores_count' => false, + 'followers_count' => false, + 'following_count' => false, + 'owned_public_scores_count' => false, + 'all_public_scores_count' => false, + 'likes_count' => false, + 'plays_count' => false, + 'cover_picture' => true, + 'profile_theme' => false, + 'links' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'type' => 'type', + 'product' => 'product', + 'username' => 'username', + 'printable_name' => 'printableName', + 'firstname' => 'firstname', + 'lastname' => 'lastname', + 'name' => 'name', + 'picture' => 'picture', + 'badges' => 'badges', + 'organization' => 'organization', + 'organization_role' => 'organizationRole', + 'class_role' => 'classRole', + 'html_url' => 'htmlUrl', + 'bio' => 'bio', + 'registration_date' => 'registrationDate', + 'liked_scores_count' => 'likedScoresCount', + 'followers_count' => 'followersCount', + 'following_count' => 'followingCount', + 'owned_public_scores_count' => 'ownedPublicScoresCount', + 'all_public_scores_count' => 'allPublicScoresCount', + 'likes_count' => 'likesCount', + 'plays_count' => 'playsCount', + 'cover_picture' => 'coverPicture', + 'profile_theme' => 'profileTheme', + 'links' => 'links' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'type' => 'setType', + 'product' => 'setProduct', + 'username' => 'setUsername', + 'printable_name' => 'setPrintableName', + 'firstname' => 'setFirstname', + 'lastname' => 'setLastname', + 'name' => 'setName', + 'picture' => 'setPicture', + 'badges' => 'setBadges', + 'organization' => 'setOrganization', + 'organization_role' => 'setOrganizationRole', + 'class_role' => 'setClassRole', + 'html_url' => 'setHtmlUrl', + 'bio' => 'setBio', + 'registration_date' => 'setRegistrationDate', + 'liked_scores_count' => 'setLikedScoresCount', + 'followers_count' => 'setFollowersCount', + 'following_count' => 'setFollowingCount', + 'owned_public_scores_count' => 'setOwnedPublicScoresCount', + 'all_public_scores_count' => 'setAllPublicScoresCount', + 'likes_count' => 'setLikesCount', + 'plays_count' => 'setPlaysCount', + 'cover_picture' => 'setCoverPicture', + 'profile_theme' => 'setProfileTheme', + 'links' => 'setLinks' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'type' => 'getType', + 'product' => 'getProduct', + 'username' => 'getUsername', + 'printable_name' => 'getPrintableName', + 'firstname' => 'getFirstname', + 'lastname' => 'getLastname', + 'name' => 'getName', + 'picture' => 'getPicture', + 'badges' => 'getBadges', + 'organization' => 'getOrganization', + 'organization_role' => 'getOrganizationRole', + 'class_role' => 'getClassRole', + 'html_url' => 'getHtmlUrl', + 'bio' => 'getBio', + 'registration_date' => 'getRegistrationDate', + 'liked_scores_count' => 'getLikedScoresCount', + 'followers_count' => 'getFollowersCount', + 'following_count' => 'getFollowingCount', + 'owned_public_scores_count' => 'getOwnedPublicScoresCount', + 'all_public_scores_count' => 'getAllPublicScoresCount', + 'likes_count' => 'getLikesCount', + 'plays_count' => 'getPlaysCount', + 'cover_picture' => 'getCoverPicture', + 'profile_theme' => 'getProfileTheme', + 'links' => 'getLinks' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const TYPE_USER = 'user'; + public const TYPE_GUEST = 'guest'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getTypeAllowableValues() + { + return [ + self::TYPE_USER, + self::TYPE_GUEST, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('product', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('printable_name', $data ?? [], null); + $this->setIfExists('firstname', $data ?? [], null); + $this->setIfExists('lastname', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('picture', $data ?? [], null); + $this->setIfExists('badges', $data ?? [], null); + $this->setIfExists('organization', $data ?? [], null); + $this->setIfExists('organization_role', $data ?? [], null); + $this->setIfExists('class_role', $data ?? [], null); + $this->setIfExists('html_url', $data ?? [], null); + $this->setIfExists('bio', $data ?? [], null); + $this->setIfExists('registration_date', $data ?? [], null); + $this->setIfExists('liked_scores_count', $data ?? [], null); + $this->setIfExists('followers_count', $data ?? [], null); + $this->setIfExists('following_count', $data ?? [], null); + $this->setIfExists('owned_public_scores_count', $data ?? [], null); + $this->setIfExists('all_public_scores_count', $data ?? [], null); + $this->setIfExists('likes_count', $data ?? [], null); + $this->setIfExists('plays_count', $data ?? [], null); + $this->setIfExists('cover_picture', $data ?? [], null); + $this->setIfExists('profile_theme', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + $allowedValues = self::getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['product'] === null) { + $invalidProperties[] = "'product' can't be null"; + } + if ($this->container['username'] === null) { + $invalidProperties[] = "'username' can't be null"; + } + if ($this->container['picture'] === null) { + $invalidProperties[] = "'picture' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The user unique identifier + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string + */ + public function getType(): string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type The type of user account + * + * @return $this + */ + public function setType(string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = self::getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets product + * + * @return \Flat\APIClient\Model\TutteoProduct + */ + public function getProduct(): \Flat\APIClient\Model\TutteoProduct + { + return $this->container['product']; + } + + /** + * Sets product + * + * @param \Flat\APIClient\Model\TutteoProduct $product product + * + * @return $this + */ + public function setProduct(\Flat\APIClient\Model\TutteoProduct $product): static + { + if (is_null($product)) { + throw new InvalidArgumentException('non-nullable product cannot be null'); + } + $this->container['product'] = $product; + + return $this; + } + + /** + * Gets username + * + * @return string + */ + public function getUsername(): string + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string $username The user name (unique for the organization) + * + * @return $this + */ + public function setUsername(string $username): static + { + if (is_null($username)) { + throw new InvalidArgumentException('non-nullable username cannot be null'); + } + $this->container['username'] = $username; + + return $this; + } + + /** + * Gets printable_name + * + * @return string|null + */ + public function getPrintableName(): ?string + { + return $this->container['printable_name']; + } + + /** + * Sets printable_name + * + * @param string|null $printable_name The name that can be directly printed (name, firstname & lastname, or username) + * + * @return $this + */ + public function setPrintableName(?string $printable_name): static + { + if (is_null($printable_name)) { + throw new InvalidArgumentException('non-nullable printable_name cannot be null'); + } + $this->container['printable_name'] = $printable_name; + + return $this; + } + + /** + * Gets firstname + * + * @return string|null + */ + public function getFirstname(): ?string + { + return $this->container['firstname']; + } + + /** + * Sets firstname + * + * @param string|null $firstname Firstname of the user (for education users) + * + * @return $this + */ + public function setFirstname(?string $firstname): static + { + if (is_null($firstname)) { + throw new InvalidArgumentException('non-nullable firstname cannot be null'); + } + $this->container['firstname'] = $firstname; + + return $this; + } + + /** + * Gets lastname + * + * @return string|null + */ + public function getLastname(): ?string + { + return $this->container['lastname']; + } + + /** + * Sets lastname + * + * @param string|null $lastname Lastname of the user (for education users) + * + * @return $this + */ + public function setLastname(?string $lastname): static + { + if (is_null($lastname)) { + throw new InvalidArgumentException('non-nullable lastname cannot be null'); + } + $this->container['lastname'] = $lastname; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name A displayable name for the user (for consumer users) + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets picture + * + * @return string + */ + public function getPicture(): string + { + return $this->container['picture']; + } + + /** + * Sets picture + * + * @param string $picture The URL of the picture to display + * + * @return $this + */ + public function setPicture(string $picture): static + { + if (is_null($picture)) { + throw new InvalidArgumentException('non-nullable picture cannot be null'); + } + $this->container['picture'] = $picture; + + return $this; + } + + /** + * Gets badges + * + * @return string[]|null + */ + public function getBadges(): ?array + { + return $this->container['badges']; + } + + /** + * Sets badges + * + * @param string[]|null $badges List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` + * + * @return $this + */ + public function setBadges(?array $badges): static + { + if (is_null($badges)) { + throw new InvalidArgumentException('non-nullable badges cannot be null'); + } + $this->container['badges'] = $badges; + + return $this; + } + + /** + * Gets organization + * + * @return string|null + */ + public function getOrganization(): ?string + { + return $this->container['organization']; + } + + /** + * Sets organization + * + * @param string|null $organization Organization ID (for Edu users only) + * + * @return $this + */ + public function setOrganization(?string $organization): static + { + if (is_null($organization)) { + throw new InvalidArgumentException('non-nullable organization cannot be null'); + } + $this->container['organization'] = $organization; + + return $this; + } + + /** + * Gets organization_role + * + * @return \Flat\APIClient\Model\OrganizationRoles|null + */ + public function getOrganizationRole(): ?\Flat\APIClient\Model\OrganizationRoles + { + return $this->container['organization_role']; + } + + /** + * Sets organization_role + * + * @param \Flat\APIClient\Model\OrganizationRoles|null $organization_role organization_role + * + * @return $this + */ + public function setOrganizationRole(?\Flat\APIClient\Model\OrganizationRoles $organization_role): static + { + if (is_null($organization_role)) { + throw new InvalidArgumentException('non-nullable organization_role cannot be null'); + } + $this->container['organization_role'] = $organization_role; + + return $this; + } + + /** + * Gets class_role + * + * @return \Flat\APIClient\Model\ClassRoles|null + */ + public function getClassRole(): ?\Flat\APIClient\Model\ClassRoles + { + return $this->container['class_role']; + } + + /** + * Sets class_role + * + * @param \Flat\APIClient\Model\ClassRoles|null $class_role class_role + * + * @return $this + */ + public function setClassRole(?\Flat\APIClient\Model\ClassRoles $class_role): static + { + if (is_null($class_role)) { + throw new InvalidArgumentException('non-nullable class_role cannot be null'); + } + $this->container['class_role'] = $class_role; + + return $this; + } + + /** + * Gets html_url + * + * @return string|null + */ + public function getHtmlUrl(): ?string + { + return $this->container['html_url']; + } + + /** + * Sets html_url + * + * @param string|null $html_url Link to user profile (for Indiv. users only) + * + * @return $this + */ + public function setHtmlUrl(?string $html_url): static + { + if (is_null($html_url)) { + throw new InvalidArgumentException('non-nullable html_url cannot be null'); + } + $this->container['html_url'] = $html_url; + + return $this; + } + + /** + * Gets bio + * + * @return string|null + */ + public function getBio(): ?string + { + return $this->container['bio']; + } + + /** + * Sets bio + * + * @param string|null $bio User's biography + * + * @return $this + */ + public function setBio(?string $bio): static + { + if (is_null($bio)) { + throw new InvalidArgumentException('non-nullable bio cannot be null'); + } + $this->container['bio'] = $bio; + + return $this; + } + + /** + * Gets registration_date + * + * @return \DateTime|null + */ + public function getRegistrationDate(): ?\DateTime + { + return $this->container['registration_date']; + } + + /** + * Sets registration_date + * + * @param \DateTime|null $registration_date Date the user signed up + * + * @return $this + */ + public function setRegistrationDate(?\DateTime $registration_date): static + { + if (is_null($registration_date)) { + throw new InvalidArgumentException('non-nullable registration_date cannot be null'); + } + $this->container['registration_date'] = $registration_date; + + return $this; + } + + /** + * Gets liked_scores_count + * + * @return int|null + */ + public function getLikedScoresCount(): ?int + { + return $this->container['liked_scores_count']; + } + + /** + * Sets liked_scores_count + * + * @param int|null $liked_scores_count Number of the scores liked by the user + * + * @return $this + */ + public function setLikedScoresCount(?int $liked_scores_count): static + { + if (is_null($liked_scores_count)) { + throw new InvalidArgumentException('non-nullable liked_scores_count cannot be null'); + } + $this->container['liked_scores_count'] = $liked_scores_count; + + return $this; + } + + /** + * Gets followers_count + * + * @return int|null + */ + public function getFollowersCount(): ?int + { + return $this->container['followers_count']; + } + + /** + * Sets followers_count + * + * @param int|null $followers_count Number of followers the user have + * + * @return $this + */ + public function setFollowersCount(?int $followers_count): static + { + if (is_null($followers_count)) { + throw new InvalidArgumentException('non-nullable followers_count cannot be null'); + } + $this->container['followers_count'] = $followers_count; + + return $this; + } + + /** + * Gets following_count + * + * @return int|null + */ + public function getFollowingCount(): ?int + { + return $this->container['following_count']; + } + + /** + * Sets following_count + * + * @param int|null $following_count Number of people the user follow + * + * @return $this + */ + public function setFollowingCount(?int $following_count): static + { + if (is_null($following_count)) { + throw new InvalidArgumentException('non-nullable following_count cannot be null'); + } + $this->container['following_count'] = $following_count; + + return $this; + } + + /** + * Gets owned_public_scores_count + * + * @return int|null + */ + public function getOwnedPublicScoresCount(): ?int + { + return $this->container['owned_public_scores_count']; + } + + /** + * Sets owned_public_scores_count + * + * @param int|null $owned_public_scores_count Number of public scores the user have + * + * @return $this + */ + public function setOwnedPublicScoresCount(?int $owned_public_scores_count): static + { + if (is_null($owned_public_scores_count)) { + throw new InvalidArgumentException('non-nullable owned_public_scores_count cannot be null'); + } + $this->container['owned_public_scores_count'] = $owned_public_scores_count; + + return $this; + } + + /** + * Gets all_public_scores_count + * + * @return int|null + */ + public function getAllPublicScoresCount(): ?int + { + return $this->container['all_public_scores_count']; + } + + /** + * Sets all_public_scores_count + * + * @param int|null $all_public_scores_count Total number of public scores the user participates in (owned + joined) + * + * @return $this + */ + public function setAllPublicScoresCount(?int $all_public_scores_count): static + { + if (is_null($all_public_scores_count)) { + throw new InvalidArgumentException('non-nullable all_public_scores_count cannot be null'); + } + $this->container['all_public_scores_count'] = $all_public_scores_count; + + return $this; + } + + /** + * Gets likes_count + * + * @return int|null + */ + public function getLikesCount(): ?int + { + return $this->container['likes_count']; + } + + /** + * Sets likes_count + * + * @param int|null $likes_count Number of likes on the user published scores + * + * @return $this + */ + public function setLikesCount(?int $likes_count): static + { + if (is_null($likes_count)) { + throw new InvalidArgumentException('non-nullable likes_count cannot be null'); + } + $this->container['likes_count'] = $likes_count; + + return $this; + } + + /** + * Gets plays_count + * + * @return int|null + */ + public function getPlaysCount(): ?int + { + return $this->container['plays_count']; + } + + /** + * Sets plays_count + * + * @param int|null $plays_count Number of plays on the user published scores + * + * @return $this + */ + public function setPlaysCount(?int $plays_count): static + { + if (is_null($plays_count)) { + throw new InvalidArgumentException('non-nullable plays_count cannot be null'); + } + $this->container['plays_count'] = $plays_count; + + return $this; + } + + /** + * Gets cover_picture + * + * @return string|null + */ + public function getCoverPicture(): ?string + { + return $this->container['cover_picture']; + } + + /** + * Sets cover_picture + * + * @param string|null $cover_picture Cover picture (backgroud) for the profile + * + * @return $this + */ + public function setCoverPicture(?string $cover_picture): static + { + if (is_null($cover_picture)) { + array_push($this->openAPINullablesSetToNull, 'cover_picture'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cover_picture', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['cover_picture'] = $cover_picture; + + return $this; + } + + /** + * Gets profile_theme + * + * @return string|null + */ + public function getProfileTheme(): ?string + { + return $this->container['profile_theme']; + } + + /** + * Sets profile_theme + * + * @param string|null $profile_theme Theme (background) for the profile + * + * @return $this + */ + public function setProfileTheme(?string $profile_theme): static + { + if (is_null($profile_theme)) { + throw new InvalidArgumentException('non-nullable profile_theme cannot be null'); + } + $this->container['profile_theme'] = $profile_theme; + + return $this; + } + + /** + * Gets links + * + * @return \Flat\APIClient\Model\UserCommunityProfileLinks|null + */ + public function getLinks(): ?\Flat\APIClient\Model\UserCommunityProfileLinks + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param \Flat\APIClient\Model\UserCommunityProfileLinks|null $links links + * + * @return $this + */ + public function setLinks(?\Flat\APIClient\Model\UserCommunityProfileLinks $links): static + { + if (is_null($links)) { + throw new InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/UserPublicSummary.php b/src/Model/UserPublicSummary.php new file mode 100644 index 0000000..96d2230 --- /dev/null +++ b/src/Model/UserPublicSummary.php @@ -0,0 +1,876 @@ + + */ +class UserPublicSummary implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'UserPublicSummary'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'type' => 'string', + 'product' => '\Flat\APIClient\Model\TutteoProduct', + 'username' => 'string', + 'printable_name' => 'string', + 'firstname' => 'string', + 'lastname' => 'string', + 'name' => 'string', + 'picture' => 'string', + 'badges' => 'string[]', + 'organization' => 'string', + 'organization_role' => '\Flat\APIClient\Model\OrganizationRoles', + 'class_role' => '\Flat\APIClient\Model\ClassRoles', + 'html_url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'type' => null, + 'product' => null, + 'username' => null, + 'printable_name' => null, + 'firstname' => null, + 'lastname' => null, + 'name' => null, + 'picture' => null, + 'badges' => null, + 'organization' => null, + 'organization_role' => null, + 'class_role' => null, + 'html_url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'type' => false, + 'product' => false, + 'username' => false, + 'printable_name' => false, + 'firstname' => false, + 'lastname' => false, + 'name' => false, + 'picture' => false, + 'badges' => false, + 'organization' => false, + 'organization_role' => false, + 'class_role' => false, + 'html_url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'type' => 'type', + 'product' => 'product', + 'username' => 'username', + 'printable_name' => 'printableName', + 'firstname' => 'firstname', + 'lastname' => 'lastname', + 'name' => 'name', + 'picture' => 'picture', + 'badges' => 'badges', + 'organization' => 'organization', + 'organization_role' => 'organizationRole', + 'class_role' => 'classRole', + 'html_url' => 'htmlUrl' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'type' => 'setType', + 'product' => 'setProduct', + 'username' => 'setUsername', + 'printable_name' => 'setPrintableName', + 'firstname' => 'setFirstname', + 'lastname' => 'setLastname', + 'name' => 'setName', + 'picture' => 'setPicture', + 'badges' => 'setBadges', + 'organization' => 'setOrganization', + 'organization_role' => 'setOrganizationRole', + 'class_role' => 'setClassRole', + 'html_url' => 'setHtmlUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'type' => 'getType', + 'product' => 'getProduct', + 'username' => 'getUsername', + 'printable_name' => 'getPrintableName', + 'firstname' => 'getFirstname', + 'lastname' => 'getLastname', + 'name' => 'getName', + 'picture' => 'getPicture', + 'badges' => 'getBadges', + 'organization' => 'getOrganization', + 'organization_role' => 'getOrganizationRole', + 'class_role' => 'getClassRole', + 'html_url' => 'getHtmlUrl' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + public const TYPE_USER = 'user'; + public const TYPE_GUEST = 'guest'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getTypeAllowableValues() + { + return [ + self::TYPE_USER, + self::TYPE_GUEST, + ]; + } + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('product', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('printable_name', $data ?? [], null); + $this->setIfExists('firstname', $data ?? [], null); + $this->setIfExists('lastname', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('picture', $data ?? [], null); + $this->setIfExists('badges', $data ?? [], null); + $this->setIfExists('organization', $data ?? [], null); + $this->setIfExists('organization_role', $data ?? [], null); + $this->setIfExists('class_role', $data ?? [], null); + $this->setIfExists('html_url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + $allowedValues = self::getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['product'] === null) { + $invalidProperties[] = "'product' can't be null"; + } + if ($this->container['username'] === null) { + $invalidProperties[] = "'username' can't be null"; + } + if ($this->container['picture'] === null) { + $invalidProperties[] = "'picture' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The user unique identifier + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string + */ + public function getType(): string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type The type of user account + * + * @return $this + */ + public function setType(string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = self::getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets product + * + * @return \Flat\APIClient\Model\TutteoProduct + */ + public function getProduct(): \Flat\APIClient\Model\TutteoProduct + { + return $this->container['product']; + } + + /** + * Sets product + * + * @param \Flat\APIClient\Model\TutteoProduct $product product + * + * @return $this + */ + public function setProduct(\Flat\APIClient\Model\TutteoProduct $product): static + { + if (is_null($product)) { + throw new InvalidArgumentException('non-nullable product cannot be null'); + } + $this->container['product'] = $product; + + return $this; + } + + /** + * Gets username + * + * @return string + */ + public function getUsername(): string + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string $username The user name (unique for the organization) + * + * @return $this + */ + public function setUsername(string $username): static + { + if (is_null($username)) { + throw new InvalidArgumentException('non-nullable username cannot be null'); + } + $this->container['username'] = $username; + + return $this; + } + + /** + * Gets printable_name + * + * @return string|null + */ + public function getPrintableName(): ?string + { + return $this->container['printable_name']; + } + + /** + * Sets printable_name + * + * @param string|null $printable_name The name that can be directly printed (name, firstname & lastname, or username) + * + * @return $this + */ + public function setPrintableName(?string $printable_name): static + { + if (is_null($printable_name)) { + throw new InvalidArgumentException('non-nullable printable_name cannot be null'); + } + $this->container['printable_name'] = $printable_name; + + return $this; + } + + /** + * Gets firstname + * + * @return string|null + */ + public function getFirstname(): ?string + { + return $this->container['firstname']; + } + + /** + * Sets firstname + * + * @param string|null $firstname Firstname of the user (for education users) + * + * @return $this + */ + public function setFirstname(?string $firstname): static + { + if (is_null($firstname)) { + throw new InvalidArgumentException('non-nullable firstname cannot be null'); + } + $this->container['firstname'] = $firstname; + + return $this; + } + + /** + * Gets lastname + * + * @return string|null + */ + public function getLastname(): ?string + { + return $this->container['lastname']; + } + + /** + * Sets lastname + * + * @param string|null $lastname Lastname of the user (for education users) + * + * @return $this + */ + public function setLastname(?string $lastname): static + { + if (is_null($lastname)) { + throw new InvalidArgumentException('non-nullable lastname cannot be null'); + } + $this->container['lastname'] = $lastname; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name A displayable name for the user (for consumer users) + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets picture + * + * @return string + */ + public function getPicture(): string + { + return $this->container['picture']; + } + + /** + * Sets picture + * + * @param string $picture The URL of the picture to display + * + * @return $this + */ + public function setPicture(string $picture): static + { + if (is_null($picture)) { + throw new InvalidArgumentException('non-nullable picture cannot be null'); + } + $this->container['picture'] = $picture; + + return $this; + } + + /** + * Gets badges + * + * @return string[]|null + */ + public function getBadges(): ?array + { + return $this->container['badges']; + } + + /** + * Sets badges + * + * @param string[]|null $badges List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` + * + * @return $this + */ + public function setBadges(?array $badges): static + { + if (is_null($badges)) { + throw new InvalidArgumentException('non-nullable badges cannot be null'); + } + $this->container['badges'] = $badges; + + return $this; + } + + /** + * Gets organization + * + * @return string|null + */ + public function getOrganization(): ?string + { + return $this->container['organization']; + } + + /** + * Sets organization + * + * @param string|null $organization Organization ID (for Edu users only) + * + * @return $this + */ + public function setOrganization(?string $organization): static + { + if (is_null($organization)) { + throw new InvalidArgumentException('non-nullable organization cannot be null'); + } + $this->container['organization'] = $organization; + + return $this; + } + + /** + * Gets organization_role + * + * @return \Flat\APIClient\Model\OrganizationRoles|null + */ + public function getOrganizationRole(): ?\Flat\APIClient\Model\OrganizationRoles + { + return $this->container['organization_role']; + } + + /** + * Sets organization_role + * + * @param \Flat\APIClient\Model\OrganizationRoles|null $organization_role organization_role + * + * @return $this + */ + public function setOrganizationRole(?\Flat\APIClient\Model\OrganizationRoles $organization_role): static + { + if (is_null($organization_role)) { + throw new InvalidArgumentException('non-nullable organization_role cannot be null'); + } + $this->container['organization_role'] = $organization_role; + + return $this; + } + + /** + * Gets class_role + * + * @return \Flat\APIClient\Model\ClassRoles|null + */ + public function getClassRole(): ?\Flat\APIClient\Model\ClassRoles + { + return $this->container['class_role']; + } + + /** + * Sets class_role + * + * @param \Flat\APIClient\Model\ClassRoles|null $class_role class_role + * + * @return $this + */ + public function setClassRole(?\Flat\APIClient\Model\ClassRoles $class_role): static + { + if (is_null($class_role)) { + throw new InvalidArgumentException('non-nullable class_role cannot be null'); + } + $this->container['class_role'] = $class_role; + + return $this; + } + + /** + * Gets html_url + * + * @return string|null + */ + public function getHtmlUrl(): ?string + { + return $this->container['html_url']; + } + + /** + * Sets html_url + * + * @param string|null $html_url Link to user profile (for Indiv. users only) + * + * @return $this + */ + public function setHtmlUrl(?string $html_url): static + { + if (is_null($html_url)) { + throw new InvalidArgumentException('non-nullable html_url cannot be null'); + } + $this->container['html_url'] = $html_url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/UserSigninLink.php b/src/Model/UserSigninLink.php new file mode 100644 index 0000000..b13e34d --- /dev/null +++ b/src/Model/UserSigninLink.php @@ -0,0 +1,452 @@ + + */ +class UserSigninLink implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'UserSigninLink'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'url' => 'string', + 'token' => 'string', + 'expiration_date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'url' => null, + 'token' => null, + 'expiration_date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'url' => false, + 'token' => false, + 'expiration_date' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'url' => 'url', + 'token' => 'token', + 'expiration_date' => 'expirationDate' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'url' => 'setUrl', + 'token' => 'setToken', + 'expiration_date' => 'setExpirationDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'url' => 'getUrl', + 'token' => 'getToken', + 'expiration_date' => 'getExpirationDate' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('token', $data ?? [], null); + $this->setIfExists('expiration_date', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets url + * + * @return string|null + */ + public function getUrl(): ?string + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url URL to use to sign in to this account + * + * @return $this + */ + public function setUrl(?string $url): static + { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets token + * + * @return string|null + */ + public function getToken(): ?string + { + return $this->container['token']; + } + + /** + * Sets token + * + * @param string|null $token Raw sign-in token, can be used to build custom URLs (e.g. deep links) + * + * @return $this + */ + public function setToken(?string $token): static + { + if (is_null($token)) { + throw new InvalidArgumentException('non-nullable token cannot be null'); + } + $this->container['token'] = $token; + + return $this; + } + + /** + * Gets expiration_date + * + * @return \DateTime|null + */ + public function getExpirationDate(): ?\DateTime + { + return $this->container['expiration_date']; + } + + /** + * Sets expiration_date + * + * @param \DateTime|null $expiration_date Date when the link expires + * + * @return $this + */ + public function setExpirationDate(?\DateTime $expiration_date): static + { + if (is_null($expiration_date)) { + throw new InvalidArgumentException('non-nullable expiration_date cannot be null'); + } + $this->container['expiration_date'] = $expiration_date; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/UserSigninLinkCreation.php b/src/Model/UserSigninLinkCreation.php new file mode 100644 index 0000000..bbaf9d7 --- /dev/null +++ b/src/Model/UserSigninLinkCreation.php @@ -0,0 +1,384 @@ + + */ +class UserSigninLinkCreation implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'UserSigninLinkCreation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'destination_path' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'destination_path' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'destination_path' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'destination_path' => 'destinationPath' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'destination_path' => 'setDestinationPath' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'destination_path' => 'getDestinationPath' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('destination_path', $data ?? [], '/'); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets destination_path + * + * @return string|null + */ + public function getDestinationPath(): ?string + { + return $this->container['destination_path']; + } + + /** + * Sets destination_path + * + * @param string|null $destination_path Path to redirect to after signin + * + * @return $this + */ + public function setDestinationPath(?string $destination_path): static + { + if (is_null($destination_path)) { + throw new InvalidArgumentException('non-nullable destination_path cannot be null'); + } + $this->container['destination_path'] = $destination_path; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/OAuth.php b/src/OAuth.php new file mode 100644 index 0000000..0064382 --- /dev/null +++ b/src/OAuth.php @@ -0,0 +1,186 @@ + $payload */ + public static function fromResponse(array $payload): self + { + $expiresIn = $payload['expires_in'] ?? null; + + return new self( + accessToken: (string) $payload['access_token'], + refreshToken: isset($payload['refresh_token']) ? (string) $payload['refresh_token'] : null, + expiresAt: $expiresIn !== null ? time() + (int) $expiresIn : null, + ); + } + + public function expired(): bool + { + // Refresh slightly before nominal expiry, to avoid racing the server clock. + return $this->expiresAt !== null && time() >= $this->expiresAt - 30; + } +} + +final class OAuth2Helper +{ + private const AUTHORIZE_URL = 'https://flat.io/auth/oauth'; + private const TOKEN_URL = 'https://api.flat.io/oauth/access_token'; + + public function __construct( + private readonly string $clientId, + private readonly string $clientSecret, + private readonly string $redirectUri, + ) {} + + /** + * URL to send a user to. $offline is what yields a refresh token. + * + * @param string[] $scopes + */ + public function authorizeUrl(array $scopes, string $state, bool $offline = true): string + { + $params = [ + 'client_id' => $this->clientId, + 'redirect_uri' => $this->redirectUri, + 'response_type' => 'code', + 'scope' => implode(' ', $scopes), + 'state' => $state, + ]; + if ($offline) { $params['access_type'] = 'offline'; } + + return self::AUTHORIZE_URL . '?' . http_build_query($params); + } + + public function exchangeCode(string $code): Tokens + { + return $this->tokenRequest([ + 'grant_type' => 'authorization_code', + 'code' => $code, + 'redirect_uri' => $this->redirectUri, + ]); + } + + public function refresh(string $refreshToken): Tokens + { + return $this->tokenRequest(['grant_type' => 'refresh_token', 'refresh_token' => $refreshToken]); + } + + /** @param array $payload */ + private function tokenRequest(array $payload): Tokens + { + $body = http_build_query(array_merge($payload, [ + 'client_id' => $this->clientId, + 'client_secret' => $this->clientSecret, + ])); + + $context = stream_context_create(['http' => [ + 'method' => 'POST', + 'header' => "Content-Type: application/x-www-form-urlencoded\r\n", + 'content' => $body, + 'ignore_errors' => true, + 'timeout' => 30, + ]]); + + $raw = @file_get_contents(self::TOKEN_URL, false, $context); + $status = self::statusFrom($http_response_header ?? []); + + if ($raw === false || $status >= 400) { + throw new FlatAuthenticationError( + 'OAuth2 token request failed; the user must re-authorize', + status: $status, + ); + } + + /** @var array $decoded */ + $decoded = json_decode($raw, true, 512, JSON_THROW_ON_ERROR); + + return Tokens::fromResponse($decoded); + } + + /** @param string[] $headers */ + private static function statusFrom(array $headers): int + { + foreach ($headers as $header) { + if (preg_match('#^HTTP/\S+\s+(\d{3})#', $header, $m) === 1) { + return (int) $m[1]; + } + } + + return 0; + } +} + +/** + * Holds the current tokens and refreshes them at most once at a time. + * + * Single-flight matters: two concurrent requests hitting an expired token must not both refresh, + * because the second refresh would invalidate the token the first just obtained. + */ +final class TokenManager +{ + private bool $refreshing = false; + + /** @param null|callable(Tokens): void $onTokenRefresh */ + public function __construct( + private Tokens $tokens, + private readonly ?OAuth2Helper $helper = null, + private readonly mixed $onTokenRefresh = null, + ) {} + + /** + * The token to send, refreshed first if it has expired. + * + * This used to return the stored token whatever its state, which made Tokens::expired() dead + * code: every request after the expiry failed with a 401 that a refresh would have avoided. + */ + public function accessToken(): string + { + return $this->tokens->expired() ? $this->refresh() : $this->tokens->accessToken; + } + + public function refresh(): string + { + if ($this->refreshing) { + return $this->tokens->accessToken; + } + if ($this->helper === null || $this->tokens->refreshToken === null) { + throw new FlatAuthenticationError( + 'the access token expired and no refresh token is available; re-authorize' + ); + } + + $this->refreshing = true; + try { + $this->tokens = $this->helper->refresh($this->tokens->refreshToken); + if (is_callable($this->onTokenRefresh)) { + ($this->onTokenRefresh)($this->tokens); + } + + return $this->tokens->accessToken; + } finally { + $this->refreshing = false; + } + } +} diff --git a/src/ObjectSerializer.php b/src/ObjectSerializer.php new file mode 100644 index 0000000..f4a76bf --- /dev/null +++ b/src/ObjectSerializer.php @@ -0,0 +1,649 @@ +format('Y-m-d') : $data->format(self::$dateTimeFormat); + } + + if ($data instanceof \BackedEnum) { + return $data->value; + } + + if (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + return $data; + } + + if (is_object($data)) { + $values = []; + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + if (is_subclass_of($openAPIType, '\BackedEnum')) { + if (is_scalar($value)) { + $value = $openAPIType::tryFrom($value); + if ($value === null) { + $imploded = implode("', '", array_map(fn($case) => $case->value, $openAPIType::cases())); + throw new \InvalidArgumentException( + sprintf( + "Invalid value for enum '%s', must be one of: '%s'", + $openAPIType::class, + $imploded + ) + ); + } + } + } + } + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } + } + } else { + foreach ($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); + } + } + return (object) $values; + } else { + return (string)$data; + } + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename(string $filename): string + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } else { + return $filename; + } + } + + /** + * Shorter timestamp microseconds to 6 digits length. + * + * @param string $timestamp Original timestamp + * + * @return string the shorten timestamp + */ + public static function sanitizeTimestamp(string $timestamp): string + { + return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the path, by url-encoding. + * + * @param string $value a string which will be part of the path + * + * @return string the serialized object + */ + public static function toPathValue(string $value): string + { + return rawurlencode(self::toString($value)); + } + + /** + * Checks if a value is empty, based on its OpenAPI type. + * + * @param mixed $value + * @param string $openApiType + * + * @return bool true if $value is empty + */ + private static function isEmptyValue(mixed $value, string $openApiType): bool + { + // If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + // Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + return match ($openApiType) { + // For numeric values, false and '' are considered empty. + // This comparison is safe for floating point values, since the previous call to empty() will + // filter out values that don't match 0. + 'int','integer' => $value !== 0, + 'number'|'float' => $value !== 0 && $value !== 0.0, + + // For boolean values, '' is considered empty + 'bool','boolean' => !in_array($value, [false, 0], true), + + // For string values, '' is considered empty. + 'string' => $value === '', + + // For all the other types, any value at this point can be considered empty. + default => true + }; + } + + /** + * Take query parameter properties and turn it into an array suitable for + * native http_build_query or GuzzleHttp\Psr7\Query::build. + * + * @param mixed $value Parameter value + * @param string $paramName Parameter name + * @param string $openApiType OpenAPIType e.g. array or object + * @param string $style Parameter serialization style + * @param bool $explode Parameter explode option + * @param bool $required Whether query param is required or not + * + * @return array + */ + public static function toQueryValue( + mixed $value, + string $paramName, + string $openApiType = 'string', + string $style = 'form', + bool $explode = true, + bool $required = true + ): array { + + // Check if we should omit this parameter from the query. This should only happen when: + // - Parameter is NOT required; AND + // - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + // example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { + if ($required) { + return ["{$paramName}" => '']; + } else { + return []; + } + } + + // Handle DateTime objects in query + if ($openApiType === "string" && $value instanceof DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + + $query = []; + $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; + + // since \GuzzleHttp\Psr7\Query::build fails with nested arrays + // need to flatten array first + $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) { + if (!is_array($arr)) { + return $arr; + } + + foreach ($arr as $k => $v) { + $prop = ($style === 'deepObject') ? "{$name}[{$k}]" : $k; + + if (is_array($v)) { + $flattenArray($v, $prop, $result); + } else { + if ($style !== 'deepObject' && !$explode) { + // push key itself + $result[] = $prop; + } + + if ($v instanceof BackedEnum) { + $v = $v->value; + } + + $result[$prop] = $v; + } + } + return $result; + }; + + $value = $flattenArray($value, $paramName); + + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { + return $value; + } + + if ('boolean' === $openApiType && is_bool($value)) { + $value = self::convertBoolToQueryStringFormat($value); + } + + // handle style in serializeCollection + $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style); + + return $query; + } + + /** + * Convert boolean value to format for query string. + * + * @param bool $value Boolean value + * + * @return int|string Boolean value in format + */ + public static function convertBoolToQueryStringFormat(bool $value): int|string + { + if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { + return $value ? 'true' : 'false'; + } + + return (int) $value; + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the header. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string $value a string which will be part of the header + * + * @return string the header string + */ + public static function toHeaderValue(string $value): string + { + $callable = [$value, 'toHeaderValue']; + if (is_callable($callable)) { + return $callable(); + } + + return self::toString($value); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the parameter. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * If it's a boolean, convert it to "true" or "false". + * + * @param string|bool|DateTime $value the value of the parameter + * + * @return string the header string + */ + public static function toString(string|bool|DateTime $value): string + { + if ($value instanceof DateTime) { // datetime in ISO8601 format + return $value->format(self::$dateTimeFormat); + } elseif (is_bool($value)) { + return $value ? 'true' : 'false'; + } else { + return (string) $value; + } + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $style the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, string $style, bool $allowCollectionFormatMulti = false): string + { + if ($allowCollectionFormatMulti && ('multi' === $style)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + return match ($style) { + 'pipeDelimited', 'pipes' => implode('|', $collection), + 'tsv' => implode("\t", $collection), + 'spaceDelimited', 'ssv' => implode(' ', $collection), + default => implode(',', $collection), + }; + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[]|null $httpHeaders HTTP headers + * + * @return mixed a single or an array of $class instances + */ + public static function deserialize(mixed $data, string $class, ?array $httpHeaders = null): mixed + { + if (null === $data) { + return null; + } + + if (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; + + if (!is_array($data)) { + throw new \InvalidArgumentException("Invalid array '$class'"); + } + + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } + + if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); + $inner = substr($class, 4, -1); + $deserialized = []; + if (strrpos($inner, ",") !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + return $deserialized; + } + + if ($class === 'mixed') { + settype($data, gettype($data)); + return $data; + } + + if ($class === '\DateTime') { + // Some APIs return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + try { + return new DateTime($data); + } catch (\Exception $exception) { + // Some APIs return a date-time with too high nanosecond + // precision for php's DateTime to handle. + // With provided regexp 6 digits of microseconds saved + return new DateTime(self::sanitizeTimestamp($data)); + } + } else { + return null; + } + } + + if ($class === '\Psr\Http\Message\StreamInterface') { + return Utils::streamFor($data); + } + + if ($class === '\SplFileObject') { + $data = Utils::streamFor($data); + + /** @var \Psr\Http\Message\StreamInterface $data */ + + // determine file name + if ( + is_array($httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) + && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) + ) { + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); + } else { + $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); + } + + $file = fopen($filename, 'w'); + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); + } + fclose($file); + + return new \SplFileObject($filename, 'r'); + } + + /** @psalm-suppress ParadoxicalCondition */ + // handle primitive types + if (in_array($class, ['\DateTime', '\SplFileObject'], true)) { + return $data; + } elseif (in_array($class, ['array', 'bool', 'boolean', 'float', 'double', 'int', 'integer', 'object', 'string', 'null'], true)) { + // type ref: https://www.php.net/manual/en/function.settype.php + // byte, mixed, void in the old php client were removed + settype($data, $class); + return $data; + } + + + if (is_subclass_of($class, '\BackedEnum')) { + $data = $class::tryFrom($data); + if ($data === null) { + $imploded = implode("', '", array_map(fn($case) => $case->value, $class::cases())); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + return $data; + } else { + $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object) $data; + } + + // A oneOf schema is not a value object: resolve the data to one of its member types. + if (is_subclass_of($class, '\Flat\APIClient\Model\OneOfInterface')) { + return self::deserializeOneOf($data, $class, $httpHeaders); + } + + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\Flat\APIClient\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + + /** @var ModelInterface $instance */ + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + + continue; + } + + if (isset($data->{$instance::attributeMap()[$property]})) { + $propertyValue = $data->{$instance::attributeMap()[$property]}; + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + return $instance; + } + } + + /** + * Deserialize data into one of the member types of a `oneOf` schema. + * + * When the schema declares a discriminator, its value selects the member type directly. + * Otherwise each member type is tried in turn and the first one that yields a valid model + * (or a non-null primitive) is returned. + * + * @param mixed $data the data already decoded to an object + * @param string $class a class name implementing OneOfInterface + * @param string[]|null $httpHeaders HTTP headers + * + * @return mixed an instance of one of the `oneOf` member types + */ + private static function deserializeOneOf(mixed $data, string $class, ?array $httpHeaders): mixed + { + $discriminator = $class::getOneOfDiscriminator(); + if ($discriminator !== null && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $mappings = $class::getOneOfDiscriminatorMappings(); + if (isset($mappings[$data->{$discriminator}])) { + return self::deserialize($data, $mappings[$data->{$discriminator}], $httpHeaders); + } + } + + foreach ($class::getOneOfTypes() as $type) { + try { + $instance = self::deserialize($data, $type, $httpHeaders); + } catch (\Throwable $e) { + // The data does not match this member type, try the next one. + continue; + } + + if ($instance instanceof ModelInterface) { + if ($instance->valid()) { + return $instance; + } + } elseif ($instance !== null) { + return $instance; + } + } + + throw new \InvalidArgumentException(sprintf('No matching schema in oneOf %s for the given data', $class)); + } + + /** + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? substr($qs, 0, -1) : ''; + } +} diff --git a/src/Pagination.php b/src/Pagination.php new file mode 100644 index 0000000..d0543a4 --- /dev/null +++ b/src/Pagination.php @@ -0,0 +1,96 @@ + url]. + * + * @return array + */ + public static function parseLinkHeader(?string $value): array + { + if ($value === null || $value === '') { return []; } + + preg_match_all('/<([^>]+)>\s*;\s*rel="([^"]+)"/', $value, $matches, PREG_SET_ORDER); + $out = []; + foreach ($matches as $match) { $out[$match[2]] = $match[1]; } + + return $out; + } + + /** + * Extract the opaque `next` cursor from a response's Link header, if any. + * + * @param array $headers + */ + public static function nextCursor(array $headers): ?string + { + foreach ($headers as $key => $value) { + if (strtolower((string) $key) !== 'link') { continue; } + $link = is_array($value) ? ($value[0] ?? '') : $value; + $url = self::parseLinkHeader($link)['next'] ?? null; + if ($url === null) { return null; } + + // Decoded, not captured raw. The cursor arrives percent-encoded inside the Link + // header's URL, and the client encodes whatever it is handed when building the next + // request, so passing the encoded form through sends it twice-encoded and the server + // rejects the cursor it issued a moment earlier. parse_str applies the same rules the + // server used to write it, so an opaque value round-trips exactly. + $query = parse_url($url, PHP_URL_QUERY); + if (!is_string($query) || $query === '') { + return null; + } + parse_str($query, $parsed); + $next = $parsed['next'] ?? null; + + return is_string($next) && $next !== '' ? $next : null; + } + + return null; + } + + /** + * Yield every item across all pages of a cursor-paginated operation. + * + * $fetchPage receives a params array and must return [data, status, headers], which is what the + * generated *WithHttpInfo methods return. A token expiring mid-traversal is refreshed by the + * client and the traversal resumes from the same cursor, so no page is skipped or repeated. + * + * @param callable(array): array{0: iterable, 1: int, 2: array} $fetchPage + * @param array $params + * @return \Generator + */ + public static function paginate(callable $fetchPage, array $params = []): \Generator + { + $cursor = $params['next'] ?? null; + unset($params['next']); + $seen = []; + + while (true) { + $pageParams = $cursor !== null ? array_merge($params, ['next' => $cursor]) : $params; + [$data, , $headers] = $fetchPage($pageParams); + foreach ($data as $item) { yield $item; } + + $cursor = self::nextCursor($headers); + if ($cursor === null) { return; } + // A server that returns a cursor it already gave us would loop forever. + if (isset($seen[$cursor])) { return; } + $seen[$cursor] = true; + } + } +} diff --git a/src/Retry.php b/src/Retry.php new file mode 100644 index 0000000..d9012ec --- /dev/null +++ b/src/Retry.php @@ -0,0 +1,63 @@ +attempts > 1; + } + + public function shouldRetry(\Throwable $error, string $method, int $attempt): bool + { + if ($attempt >= $this->attempts) { return false; } + if (!in_array(strtoupper($method), self::IDEMPOTENT, true)) { return false; } + + return $error instanceof FlatRateLimitError + || $error instanceof FlatServerError + // A transport failure before the request was sent is safe to replay. + || ($error instanceof \RuntimeException && !$error instanceof FlatError); + } + + public function delayFor(\Throwable $error, int $attempt): float + { + if ($this->respectRateLimitReset && $error instanceof FlatRateLimitError && $error->reset !== null) { + $wait = $error->reset - time(); + if ($wait > 0) { + return min($wait + (mt_rand() / mt_getrandmax()) * $this->jitter, self::MAX_RATE_LIMIT_WAIT); + } + } + $exponential = min($this->backoffBase * (2 ** ($attempt - 1)), $this->backoffMax); + + return $exponential + (mt_rand() / mt_getrandmax()) * $this->jitter * $exponential; + } +} diff --git a/test/Api/AccountApiTest.php b/test/Api/AccountApiTest.php deleted file mode 100644 index 48221d9..0000000 --- a/test/Api/AccountApiTest.php +++ /dev/null @@ -1,83 +0,0 @@ - 1 else os.environ.get("FLAT_SPEC", ROOT / ".openapi-spec.yaml") +) +HTTP_METHODS = {"get", "post", "put", "patch", "delete", "head", "options"} + + +def snake(name: str) -> str: + name = re.sub(r"(.)([A-Z][a-z]+)", r"\1_\2", name) + return re.sub(r"([a-z0-9])([A-Z])", r"\1_\2", name).lower() + + +def resolve_params(spec: dict, op: dict, item: dict) -> list[dict]: + """Path-level plus operation-level parameters, with $ref resolved. + + `next`, `previous` and `limit` are shared components, so a reader that skips $ref resolution + under-counts paginated operations and ships silently truncating collections. + """ + out = [] + for p in list(item.get("parameters") or []) + list(op.get("parameters") or []): + if isinstance(p, dict) and "$ref" in p: + ref = p["$ref"].split("/")[-1] + p = ((spec.get("components") or {}).get("parameters") or {}).get(ref, {}) + if isinstance(p, dict): + out.append(p) + return out + + +def documented(op: dict, params: list[dict]) -> bool: + if not (op.get("description") or op.get("summary")): + return False + if any(not p.get("description") for p in params): + return False + responses = op.get("responses") or {} + return bool(responses) and all( + bool((r or {}).get("description")) for r in responses.values() if isinstance(r, dict) + ) + + +def main() -> None: + spec = yaml.safe_load(SPEC.read_text()) + + symbols: dict[str, str] = {} + for path in (ROOT / "src" / "Api").glob("*.php"): + for match in re.finditer(r"public function (\w+)\(", path.read_text()): + symbols.setdefault(match.group(1), path.stem) + + models = set() + for path in (ROOT / "src" / "Model").glob("*.php"): + text = path.read_text() + models |= set(re.findall(r"^(?:class|enum|interface) (\w+)\b", text, re.M)) + + operations = [] + for path, item in (spec.get("paths") or {}).items(): + for method, op in item.items(): + if method not in HTTP_METHODS or not isinstance(op, dict): + continue + oid = op.get("operationId") + if not oid: + continue + params = resolve_params(spec, op, item) + fn = oid # camelCase operationId maps directly + operations.append( + { + "operation_id": oid, + "method": method, + "path": path, + "symbol": f"{symbols.get(fn, '?')}.{fn}", + "paginated": any( + p.get("name") == "next" and p.get("in") == "query" for p in params + ), + "documented": documented(op, params), + } + ) + + scopes: set[str] = set() + for scheme in ((spec.get("components") or {}).get("securitySchemes") or {}).values(): + for flow in ((scheme or {}).get("flows") or {}).values(): + scopes |= set((flow or {}).get("scopes", {}).keys()) + + inventory = { + "schema_version": 1, + "spec_version": (spec.get("info") or {}).get("version"), + "generator": {"name": "php-nextgen", "version": "7.24.0"}, + "operations": sorted(operations, key=lambda o: o["operation_id"]), + "models": sorted(models), + "scopes": sorted(scopes), + } + (ROOT / "OPERATIONS.json").write_text(json.dumps(inventory, indent=2) + "\n") + print(f" {len(operations)} operations, {len(models)} models, {len(scopes)} scopes") + + +if __name__ == "__main__": + main() diff --git a/tools/generate.sh b/tools/generate.sh new file mode 100755 index 0000000..d500e90 --- /dev/null +++ b/tools/generate.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash +# Regenerate the Flat PHP SDK from the public OpenAPI specification. +# +# Self-contained (FR-023): fetches the spec, runs the pinned generator into a scratch tree, copies +# only the paths .sdkgen.yaml declares generated, applies patches, emits the inventory, bumps. +# +# Generating into a scratch tree and copying selectively makes FR-025d structural: the generator +# cannot write outside the declared zone, so protected files can never be clobbered. +# +# SPEC_REF api-reference release tag (default: latest release) +# SPEC_LOCAL_FILE use this local spec instead +# BUMP patch | minor | major | none (default: patch) +set -euo pipefail + +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$REPO_ROOT" +# shellcheck source=tools/lib/generate-common.sh +source tools/lib/generate-common.sh + +# VERSION is the durable source of truth, outside the generated zone. +CUR_VERSION="$(cat VERSION 2>/dev/null || true)" +[ -n "$CUR_VERSION" ] || CUR_VERSION="$(read_version || echo '2.0.0')" +log "Current version $CUR_VERSION" + +resolve_spec + +SCRATCH=".sdkgen-scratch" +rm -rf "$SCRATCH" +trap 'rm -rf "$SCRATCH"; cleanup_spec' EXIT + +log "Generating" +run_generator "$(manifest_get 'generator.name')" "tools/openapi-config.json" "$SCRATCH/out" + +log "Wiping the generated zone" +zone_wipe + +log "Installing the generated zone" +mkdir -p src docs/reference .openapi-generator +cp -R "$SCRATCH/out/src/." src/ +[ -d "$SCRATCH/out/docs" ] && cp -R "$SCRATCH/out/docs/." docs/reference/ +[ -d "$SCRATCH/out/.openapi-generator" ] && cp -R "$SCRATCH/out/.openapi-generator/." .openapi-generator/ + +log "Applying post-generation patches" +for patch in tools/patches/*.py; do + [ -f "$patch" ] || continue + log " $(basename "$patch")" + python3 "$patch" || die "patch $(basename "$patch") failed (FR-025)" +done + +log "Emitting operation inventory" +python3 tools/emit_inventory.py + +NEW_VERSION="$(apply_bump "$CUR_VERSION")" +log "Version -> $NEW_VERSION" +# Nothing to write: Packagist reads the tag, and VERSION is written just below. +echo "$NEW_VERSION" > VERSION + +log "Done. Version $NEW_VERSION" diff --git a/tools/lib/generate-common.sh b/tools/lib/generate-common.sh new file mode 100644 index 0000000..f6f0089 --- /dev/null +++ b/tools/lib/generate-common.sh @@ -0,0 +1,128 @@ +#!/usr/bin/env bash +# Shared generation helpers. Vendored per SDK on purpose: each repository must be able to +# regenerate itself with no orchestrator and no sibling checkout (FR-023). + +SPEC_FILE="${SPEC_FILE:-$REPO_ROOT/.openapi-spec.yaml}" +BUMP="${BUMP:-patch}" +API_REFERENCE_RAW="https://raw.githubusercontent.com/FlatIO/api-reference" + +log() { printf '\033[1;34m==>\033[0m %s\n' "$*"; } +die() { printf '\033[1;31merror:\033[0m %s\n' "$*" >&2; exit 1; } + +cleanup_spec() { rm -f "$SPEC_FILE"; } +trap cleanup_spec EXIT + +manifest_get() { + python3 - "$1" <<'PY' +import sys, yaml, functools, operator +key = sys.argv[1].split(".") +doc = yaml.safe_load(open(".sdkgen.yaml")) +print(functools.reduce(operator.getitem, key, doc)) +PY +} + +latest_release_tag() { + python3 - <<'PY' +import json, urllib.request +url = "https://api.github.com/repos/FlatIO/api-reference/releases/latest" +with urllib.request.urlopen(url, timeout=30) as r: + print(json.load(r)["tag_name"]) +PY +} + +resolve_spec() { + if [ -n "${SPEC_LOCAL_FILE:-}" ]; then + log "Using local spec: $SPEC_LOCAL_FILE" + cp "$SPEC_LOCAL_FILE" "$SPEC_FILE" + else + local ref="${SPEC_REF:-$(latest_release_tag)}" + log "Fetching FlatIO/api-reference@$ref" + curl -fsSL "$API_REFERENCE_RAW/$ref/spec/openapi.yaml" -o "$SPEC_FILE" \ + || die "could not fetch the specification at $ref" + local declared expected + declared="$(python3 -c "import yaml,sys;print(yaml.safe_load(open('$SPEC_FILE'))['info']['version'])")" + expected="${ref#v}" + [ "$declared" = "$expected" ] \ + || die "tag/version mismatch: tag $ref implies $expected, spec declares $declared" + fi + log "Specification version $(python3 -c "import yaml;print(yaml.safe_load(open('$SPEC_FILE'))['info']['version'])")" +} + +# Remove everything .sdkgen.yaml declares generated, so a removed operation leaves no orphan. +zone_wipe() { + python3 - <<'PY' +import pathlib, shutil, yaml +doc = yaml.safe_load(open(".sdkgen.yaml")) +root = pathlib.Path(".") +n = 0 +for glob in doc["generated_paths"]: + for path in sorted(root.glob(glob), reverse=True): + if path.is_file(): + path.unlink(); n += 1 + elif path.is_dir(): + shutil.rmtree(path, ignore_errors=True) +print(f" removed {n} file(s)") +PY +} + +have_java() { command -v java >/dev/null 2>&1 && java -version >/dev/null 2>&1; } + +# run_generator +# MUST be relative to the repository root: the docker backend mounts the repo at +# /local, so an absolute path outside it lands inside the repository instead. +run_generator() { + local gen="$1" config="$2" out="$3" + case "$out" in + /*) die "run_generator: output must be repo-relative, got $out" ;; + esac + local version; version="$(manifest_get 'generator.version')" + if have_java; then + local cache="${OPENAPI_GENERATOR_CACHE:-$HOME/.cache/openapi-generator}" + local jar="$cache/openapi-generator-cli-$version.jar" + if [ ! -f "$jar" ]; then + mkdir -p "$cache" + curl -fsSL -o "$jar" \ + "https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/$version/openapi-generator-cli-$version.jar" + fi + java -jar "$jar" generate -i "$SPEC_FILE" -g "$gen" -o "$out" -c "$config" --skip-validate-spec + elif command -v docker >/dev/null 2>&1; then + docker run --rm -v "$REPO_ROOT":/local -w /local \ + "openapitools/openapi-generator-cli:v$version" \ + generate -i "/local/$(basename "$SPEC_FILE")" -g "$gen" -o "/local/$out" \ + -c "/local/$config" --skip-validate-spec + else + die "need a working java (JDK) or docker to run openapi-generator" + fi +} + +# Reads the current version through the manifest pattern. Non-zero exit when unavailable. +read_version() { + python3 - <<'RV' +import re, yaml, pathlib +doc = yaml.safe_load(open(".sdkgen.yaml")) +vf = doc["version_file"] +path = pathlib.Path(vf["path"]) +if not path.is_file(): + raise SystemExit(1) +m = re.search(vf["pattern"], path.read_text()) +if not m or m.group("version") == "0.0.0": + raise SystemExit(1) +print(m.group("version")) +RV +} + +# apply_bump -> the next version per $BUMP +apply_bump() { + python3 - "$1" "$BUMP" <<'AB' +import sys +current, bump = sys.argv[1], sys.argv[2] +major, minor, patch = (int(x) for x in current.split(".")) +match bump: + case "major": major, minor, patch = major + 1, 0, 0 + case "minor": minor, patch = minor + 1, 0 + case "patch": patch += 1 + case "none": pass + case _: raise SystemExit(f"error: invalid BUMP={bump}") +print(f"{major}.{minor}.{patch}") +AB +} diff --git a/tools/openapi-config.json b/tools/openapi-config.json new file mode 100644 index 0000000..809f45a --- /dev/null +++ b/tools/openapi-config.json @@ -0,0 +1,7 @@ +{ + "invokerPackage": "Flat\\APIClient", + "artifactVersion": "2.0.0", + "packageName": "flat-api", + "srcBasePath": "src", + "hideGenerationTimestamp": true +} diff --git a/tools/patches/20_errors.py b/tools/patches/20_errors.py new file mode 100644 index 0000000..5235e45 --- /dev/null +++ b/tools/patches/20_errors.py @@ -0,0 +1,293 @@ +#!/usr/bin/env python3 +"""Typed errors, retry and pagination for the PHP SDK (FR-006d to FR-006h). Idempotent.""" + +from __future__ import annotations + +import pathlib + +ROOT = pathlib.Path(__file__).resolve().parent.parent.parent +SRC = ROOT / "src" +SRC.mkdir(exist_ok=True) + +(SRC / "Errors.php").write_text(''' */ + public readonly array $headers = [], + public readonly mixed $body = null, + ) { + parent::__construct($message); + } + + public function __toString(): string + { + $parts = [$this->getMessage()]; + if ($this->errorCode !== null) { $parts[] = "code={$this->errorCode}"; } + if ($this->status !== null) { $parts[] = "status={$this->status}"; } + if ($this->requestId !== null) { $parts[] = "id={$this->requestId}"; } + + return implode(' ', $parts); + } +} + +/** The token is missing, invalid or expired, or a refresh failed. Re-authorize. */ +class FlatAuthenticationError extends FlatError {} +/** Authenticated but not permitted: a missing scope or insufficient permission. */ +class FlatAuthorizationError extends FlatError {} +/** The request body or parameters failed validation. */ +class FlatValidationError extends FlatError {} +/** The resource does not exist, or is not visible to this token. */ +class FlatNotFoundError extends FlatError {} +/** A metered resource, such as OMR credits, is exhausted. */ +class FlatQuotaError extends FlatError {} +/** An internal or backend error. `requestId` is normally set here. */ +class FlatServerError extends FlatError {} + +/** The account or IP exceeded its request quota. Returned as HTTP 403, not 429. */ +class FlatRateLimitError extends FlatError +{ + public readonly ?int $limit; + public readonly ?int $remaining; + /** UTC epoch seconds at which the window resets. Flat sends no Retry-After header. */ + public readonly ?int $reset; + + /** @param array $headers */ + public function __construct( + string $message, + ?int $status = null, + ?string $errorCode = null, + ?string $requestId = null, + array $headers = [], + mixed $body = null, + ) { + parent::__construct($message, $status, $errorCode, $requestId, $headers, $body); + $this->limit = self::intHeader($headers, 'x-ratelimit-limit'); + $this->remaining = self::intHeader($headers, 'x-ratelimit-remaining'); + $this->reset = self::intHeader($headers, 'x-ratelimit-reset'); + } + + /** @param array $headers */ + private static function intHeader(array $headers, string $name): ?int + { + foreach ($headers as $key => $value) { + if (strtolower((string) $key) === $name) { + return is_numeric($value) ? (int) $value : null; + } + } + + return null; + } +} + +final class ErrorFactory +{ + public const RATE_LIMIT_CODE = 'API_RATE_LIMIT_EXCEEDED'; + private const QUOTA_CODES = ['QUOTA_EXCEEDED', 'CREDITS_EXHAUSTED', 'OMR_CREDITS_EXHAUSTED']; + + /** @param array $headers */ + public static function fromResponse(int $status, mixed $body, array $headers = []): FlatError + { + $payload = is_array($body) ? $body : []; + $code = $payload['code'] ?? null; + $message = $payload['message'] ?? "HTTP {$status}"; + $id = $payload['id'] ?? null; + + if ($status === 403 && $code === self::RATE_LIMIT_CODE) { + return new FlatRateLimitError($message, $status, $code, $id, $headers, $body); + } + if ($code !== null && in_array($code, self::QUOTA_CODES, true)) { + return new FlatQuotaError($message, $status, $code, $id, $headers, $body); + } + + return match (true) { + $status === 401 => new FlatAuthenticationError($message, $status, $code, $id, $headers, $body), + $status === 403 => new FlatAuthorizationError($message, $status, $code, $id, $headers, $body), + $status === 404 => new FlatNotFoundError($message, $status, $code, $id, $headers, $body), + $status === 400, $status === 422 => new FlatValidationError($message, $status, $code, $id, $headers, $body), + $status >= 500 => new FlatServerError($message, $status, $code, $id, $headers, $body), + default => new FlatError($message, $status, $code, $id, $headers, $body), + }; + } +} +''') + +(SRC / "Retry.php").write_text('''attempts > 1; + } + + public function shouldRetry(\\Throwable $error, string $method, int $attempt): bool + { + if ($attempt >= $this->attempts) { return false; } + if (!in_array(strtoupper($method), self::IDEMPOTENT, true)) { return false; } + + return $error instanceof FlatRateLimitError + || $error instanceof FlatServerError + // A transport failure before the request was sent is safe to replay. + || ($error instanceof \\RuntimeException && !$error instanceof FlatError); + } + + public function delayFor(\\Throwable $error, int $attempt): float + { + if ($this->respectRateLimitReset && $error instanceof FlatRateLimitError && $error->reset !== null) { + $wait = $error->reset - time(); + if ($wait > 0) { + return min($wait + (mt_rand() / mt_getrandmax()) * $this->jitter, self::MAX_RATE_LIMIT_WAIT); + } + } + $exponential = min($this->backoffBase * (2 ** ($attempt - 1)), $this->backoffMax); + + return $exponential + (mt_rand() / mt_getrandmax()) * $this->jitter * $exponential; + } +} +''') + +(SRC / "Pagination.php").write_text(''' url]. + * + * @return array + */ + public static function parseLinkHeader(?string $value): array + { + if ($value === null || $value === '') { return []; } + + preg_match_all('/<([^>]+)>\\s*;\\s*rel="([^"]+)"/', $value, $matches, PREG_SET_ORDER); + $out = []; + foreach ($matches as $match) { $out[$match[2]] = $match[1]; } + + return $out; + } + + /** + * Extract the opaque `next` cursor from a response's Link header, if any. + * + * @param array $headers + */ + public static function nextCursor(array $headers): ?string + { + foreach ($headers as $key => $value) { + if (strtolower((string) $key) !== 'link') { continue; } + $link = is_array($value) ? ($value[0] ?? '') : $value; + $url = self::parseLinkHeader($link)['next'] ?? null; + if ($url === null) { return null; } + + // Decoded, not captured raw. The cursor arrives percent-encoded inside the Link + // header's URL, and the client encodes whatever it is handed when building the next + // request, so passing the encoded form through sends it twice-encoded and the server + // rejects the cursor it issued a moment earlier. parse_str applies the same rules the + // server used to write it, so an opaque value round-trips exactly. + $query = parse_url($url, PHP_URL_QUERY); + if (!is_string($query) || $query === '') { + return null; + } + parse_str($query, $parsed); + $next = $parsed['next'] ?? null; + + return is_string($next) && $next !== '' ? $next : null; + } + + return null; + } + + /** + * Yield every item across all pages of a cursor-paginated operation. + * + * $fetchPage receives a params array and must return [data, status, headers], which is what the + * generated *WithHttpInfo methods return. A token expiring mid-traversal is refreshed by the + * client and the traversal resumes from the same cursor, so no page is skipped or repeated. + * + * @param callable(array): array{0: iterable, 1: int, 2: array} $fetchPage + * @param array $params + * @return \\Generator + */ + public static function paginate(callable $fetchPage, array $params = []): \\Generator + { + $cursor = $params['next'] ?? null; + unset($params['next']); + $seen = []; + + while (true) { + $pageParams = $cursor !== null ? array_merge($params, ['next' => $cursor]) : $params; + [$data, , $headers] = $fetchPage($pageParams); + foreach ($data as $item) { yield $item; } + + $cursor = self::nextCursor($headers); + if ($cursor === null) { return; } + // A server that returns a cursor it already gave us would loop forever. + if (isset($seen[$cursor])) { return; } + $seen[$cursor] = true; + } + } +} +''') +print(" php: Errors.php, Retry.php, Pagination.php") diff --git a/tools/patches/30_client.py b/tools/patches/30_client.py new file mode 100755 index 0000000..f4b1cbb --- /dev/null +++ b/tools/patches/30_client.py @@ -0,0 +1,241 @@ +#!/usr/bin/env python3 +"""A single entry point for the PHP SDK (FR-006c). Idempotent. + +php-nextgen emits ten Api classes and no facade, so the README's first example was a fatal error +and a caller had to know which class owns an operation before making one call. + +FlatClient owns the Guzzle handler stack, which is what makes the rest reachable. The generated +code raises its own ApiException at more than a hundred sites across the ten Api classes, so +rewriting each one would be both fragile and endless. A middleware sits below all of them instead: +it converts a non-2xx response into the typed error before the generated catch blocks ever see it, +and a second one applies the retry policy. One place, no template surgery. +""" + +from __future__ import annotations + +import pathlib +import re +import sys + +ROOT = pathlib.Path(__file__).resolve().parent.parent.parent +SRC = ROOT / "src" + +# Read from what the generator emitted rather than hardcoded: a list that drifts is a fatal error +# waiting for whichever call reaches it first. +emitted = sorted(p.stem for p in (SRC / "Api").glob("*Api.php")) +if not emitted: + sys.exit("30_client: no generated *Api classes found (FR-025)") + +# scores before users: two APIs define getUserScores, and paginate resolves an operation by asking +# each in turn, so the order has to be deterministic and documented. +SHORT_NAMES = { + "AccountApi": "account", + "ClassApi": "classes", + "CollectionApi": "collections", + "EduResourcesApi": "eduResources", + "GroupApi": "groups", + "OMRApi": "omr", + "OrganizationApi": "organization", + "ScoreApi": "scores", + "TaskApi": "tasks", + "UserApi": "users", +} +missing = [c for c in emitted if c not in SHORT_NAMES] +if missing: + sys.exit(f"30_client: generated APIs with no short name: {', '.join(missing)}") + +ORDER = ["AccountApi", "ClassApi", "CollectionApi", "EduResourcesApi", "GroupApi", + "OMRApi", "OrganizationApi", "ScoreApi", "TaskApi", "UserApi"] +ordered = [c for c in ORDER if c in emitted] + +accessors = "\n\n".join( + f""" /** The generated {c}, built on this client's HTTP stack. */ + public function {SHORT_NAMES[c]}(): Api\\{c} + {{ + return $this->api('{SHORT_NAMES[c]}'); + }}""" + for c in ordered +) +api_map = "\n".join(f" '{SHORT_NAMES[c]}' => Api\\{c}::class," for c in ordered) + +(SRC / "FlatClient.php").write_text(f'''account()->getAuthenticatedUser(); + * foreach ($client->paginate('listCollections', ['parent' => 'user']) as $collection) {{ ... }} + * + * It owns one Guzzle client, so every API reached through it shares a connection, the retry + * policy and the typed errors. Constructing the generated Api classes directly still works, but + * they then carry a plain Guzzle client and raise the generator's own ApiException. + */ +final class FlatClient +{{ + public const DEFAULT_BASE_URL = 'https://api.flat.io/v2'; + /** A finite default. Waiting forever is not an acceptable default for an SDK. */ + public const DEFAULT_TIMEOUT_SECONDS = 30.0; + + private const APIS = [ +{api_map} + ]; + + private Configuration $config; + private Client $http; + private RetryPolicy $retry; + /** @var array */ + private array $apis = []; + + public function __construct( + ?string $accessToken = null, + ?Configuration $config = null, + ?RetryPolicy $retry = null, + ?string $baseUrl = null, + float $timeout = self::DEFAULT_TIMEOUT_SECONDS, + ?HandlerStack $handler = null, + ) {{ + // A fresh Configuration, not getDefaultConfiguration(): a client built with its own token + // must not replace the token every other client is using. + $this->config = $config ?? new Configuration(); + if ($accessToken !== null) {{ + $this->config->setAccessToken($accessToken); + }} + $this->config->setHost($baseUrl ?? self::DEFAULT_BASE_URL); + $this->retry = $retry ?? new RetryPolicy(); + + $stack = $handler ?? HandlerStack::create(); + $stack->push($this->typedErrors(), 'flat_typed_errors'); + $stack->push($this->retries(), 'flat_retries'); + + $this->http = new Client(['handler' => $stack, 'timeout' => $timeout, 'http_errors' => false]); + }} + + public function configuration(): Configuration + {{ + return $this->config; + }} + + public function retryPolicy(): RetryPolicy + {{ + return $this->retry; + }} + + /** + * Convert a non-2xx response into the typed error, below every generated Api. + * + * http_errors is off on the Guzzle client, so Guzzle does not raise its own exception first. + * The typed error is not a RequestException, so the generated `catch (RequestException $e)` + * blocks do not swallow it and rewrap it as an ApiException: it reaches the caller intact. + */ + private function typedErrors(): callable + {{ + return static fn (callable $next): callable => + static function (RequestInterface $request, array $options) use ($next): PromiseInterface {{ + return $next($request, $options)->then( + static function (ResponseInterface $response) {{ + $status = $response->getStatusCode(); + if ($status >= 200 && $status < 300) {{ + return $response; + }} + + $raw = (string) $response->getBody(); + // Rewound for the caller: a PSR-7 stream read to the end returns nothing + // on a second read, and the generated code may still look at it. + $response->getBody()->rewind(); + $body = json_decode($raw, true); + + $headers = []; + foreach ($response->getHeaders() as $name => $values) {{ + $headers[$name] = implode(', ', $values); + }} + + // The typed error needs the body: Flat returns 403 both for rate limiting + // and for a genuine authorization failure, and only `code` separates them. + throw ErrorFactory::fromResponse($status, is_array($body) ? $body : $raw, $headers); + }} + ); + }}; + }} + + /** Apply the retry policy to every request. */ + private function retries(): callable + {{ + $policy = $this->retry; + + return static fn (callable $next): callable => + static function (RequestInterface $request, array $options) use ($next, $policy): PromiseInterface {{ + $attempt = ($options['flat_attempt'] ?? 0) + 1; + $options['flat_attempt'] = $attempt; + + return $next($request, $options)->otherwise( + static function (\\Throwable $error) use ($request, $options, $next, $policy, $attempt) {{ + if (!$policy->shouldRetry($error, $request->getMethod(), $attempt)) {{ + throw $error; + }} + usleep((int) ($policy->delayFor($error, $attempt) * 1_000_000)); + return $next($request, $options); + }} + ); + }}; + }} + + /** One generated API by short name, memoised. */ + public function api(string $name): object + {{ + $class = self::APIS[$name] ?? null; + if ($class === null) {{ + throw new \\InvalidArgumentException( + sprintf('unknown API %s, expected one of: %s', $name, implode(', ', array_keys(self::APIS))) + ); + }} + + return $this->apis[$name] ??= new $class($this->http, $this->config); + }} + +{accessors} + + /** + * Every item across every page of a cursor-paginated operation. + * + * foreach ($client->paginate('listCollections', ['parent' => 'user']) as $collection) {{ ... }} + * + * The operation is named rather than passed, because the generated methods are instance + * methods. An operation that does not paginate yields its single page, so this is always safe. + */ + public function paginate(string $operation, array $params = []): \\Generator + {{ + $method = $operation . 'WithHttpInfo'; + $owner = null; + foreach (array_keys(self::APIS) as $name) {{ + if (method_exists($this->api($name), $method)) {{ + $owner = $this->api($name); + break; + }} + }} + if ($owner === null) {{ + throw new \\InvalidArgumentException(sprintf('no operation %s on any Flat API', $operation)); + }} + + // Spread with string keys, which PHP 8 passes as named arguments. The generated methods + // take positional parameters in specification order, so spreading array_values would hand + // `limit` to `$sort` the moment a caller omits one. + return Pagination::paginate( + static fn (array $pageParams) => $owner->{{$method}}(...$pageParams), + $params, + ); + }} +}} +''') + +print(f" client: wrote FlatClient.php (over the {len(ordered)} generated APIs)") diff --git a/tools/patches/50_oauth.py b/tools/patches/50_oauth.py new file mode 100644 index 0000000..e71faf2 --- /dev/null +++ b/tools/patches/50_oauth.py @@ -0,0 +1,199 @@ +#!/usr/bin/env python3 +"""OAuth2 helpers and single-flight refresh for the PHP SDK (FR-006i to FR-006l). Idempotent.""" + +from __future__ import annotations + +import pathlib + +ROOT = pathlib.Path(__file__).resolve().parent.parent.parent +SRC = ROOT / "src" +SRC.mkdir(exist_ok=True) + +(SRC / "OAuth.php").write_text(''' $payload */ + public static function fromResponse(array $payload): self + { + $expiresIn = $payload['expires_in'] ?? null; + + return new self( + accessToken: (string) $payload['access_token'], + refreshToken: isset($payload['refresh_token']) ? (string) $payload['refresh_token'] : null, + expiresAt: $expiresIn !== null ? time() + (int) $expiresIn : null, + ); + } + + public function expired(): bool + { + // Refresh slightly before nominal expiry, to avoid racing the server clock. + return $this->expiresAt !== null && time() >= $this->expiresAt - 30; + } +} + +final class OAuth2Helper +{ + private const AUTHORIZE_URL = 'https://flat.io/auth/oauth'; + private const TOKEN_URL = 'https://api.flat.io/oauth/access_token'; + + public function __construct( + private readonly string $clientId, + private readonly string $clientSecret, + private readonly string $redirectUri, + ) {} + + /** + * URL to send a user to. $offline is what yields a refresh token. + * + * @param string[] $scopes + */ + public function authorizeUrl(array $scopes, string $state, bool $offline = true): string + { + $params = [ + 'client_id' => $this->clientId, + 'redirect_uri' => $this->redirectUri, + 'response_type' => 'code', + 'scope' => implode(' ', $scopes), + 'state' => $state, + ]; + if ($offline) { $params['access_type'] = 'offline'; } + + return self::AUTHORIZE_URL . '?' . http_build_query($params); + } + + public function exchangeCode(string $code): Tokens + { + return $this->tokenRequest([ + 'grant_type' => 'authorization_code', + 'code' => $code, + 'redirect_uri' => $this->redirectUri, + ]); + } + + public function refresh(string $refreshToken): Tokens + { + return $this->tokenRequest(['grant_type' => 'refresh_token', 'refresh_token' => $refreshToken]); + } + + /** @param array $payload */ + private function tokenRequest(array $payload): Tokens + { + $body = http_build_query(array_merge($payload, [ + 'client_id' => $this->clientId, + 'client_secret' => $this->clientSecret, + ])); + + $context = stream_context_create(['http' => [ + 'method' => 'POST', + 'header' => "Content-Type: application/x-www-form-urlencoded\\r\\n", + 'content' => $body, + 'ignore_errors' => true, + 'timeout' => 30, + ]]); + + $raw = @file_get_contents(self::TOKEN_URL, false, $context); + $status = self::statusFrom($http_response_header ?? []); + + if ($raw === false || $status >= 400) { + throw new FlatAuthenticationError( + 'OAuth2 token request failed; the user must re-authorize', + status: $status, + ); + } + + /** @var array $decoded */ + $decoded = json_decode($raw, true, 512, JSON_THROW_ON_ERROR); + + return Tokens::fromResponse($decoded); + } + + /** @param string[] $headers */ + private static function statusFrom(array $headers): int + { + foreach ($headers as $header) { + if (preg_match('#^HTTP/\\S+\\s+(\\d{3})#', $header, $m) === 1) { + return (int) $m[1]; + } + } + + return 0; + } +} + +/** + * Holds the current tokens and refreshes them at most once at a time. + * + * Single-flight matters: two concurrent requests hitting an expired token must not both refresh, + * because the second refresh would invalidate the token the first just obtained. + */ +final class TokenManager +{ + private bool $refreshing = false; + + /** @param null|callable(Tokens): void $onTokenRefresh */ + public function __construct( + private Tokens $tokens, + private readonly ?OAuth2Helper $helper = null, + private readonly mixed $onTokenRefresh = null, + ) {} + + /** + * The token to send, refreshed first if it has expired. + * + * This used to return the stored token whatever its state, which made Tokens::expired() dead + * code: every request after the expiry failed with a 401 that a refresh would have avoided. + */ + public function accessToken(): string + { + return $this->tokens->expired() ? $this->refresh() : $this->tokens->accessToken; + } + + public function refresh(): string + { + if ($this->refreshing) { + return $this->tokens->accessToken; + } + if ($this->helper === null || $this->tokens->refreshToken === null) { + throw new FlatAuthenticationError( + 'the access token expired and no refresh token is available; re-authorize' + ); + } + + $this->refreshing = true; + try { + $this->tokens = $this->helper->refresh($this->tokens->refreshToken); + if (is_callable($this->onTokenRefresh)) { + ($this->onTokenRefresh)($this->tokens); + } + + return $this->tokens->accessToken; + } finally { + $this->refreshing = false; + } + } +} +''') +print(" php: OAuth.php") diff --git a/tools/patches/70_docs.py b/tools/patches/70_docs.py new file mode 100644 index 0000000..89c38c7 --- /dev/null +++ b/tools/patches/70_docs.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +"""Verify the generated PHP code carries the specification's documentation (FR-004). + +emit_inventory.py records what the *specification* documents. That is necessary but not sufficient: +the generator can drop a description on the way through. This checks the generated source itself and +fails loudly if operation documentation is missing, so a silent regression in generator +configuration cannot ship an undocumented SDK. + +Idempotent: it inspects and reports, it does not rewrite. +""" + +from __future__ import annotations + +import pathlib +import re +import sys + +ROOT = pathlib.Path(__file__).resolve().parent.parent.parent +SOURCES = ["src/Api/*.php"] + +#: Below this, the generator has stopped propagating descriptions and the config is wrong. +THRESHOLD = 0.95 + +OPERATION = re.compile( + r"^ public function (?!.*(?:WithHttpInfo|Async|AsyncWithHttpInfo|Request)\()(\w+)\(", + re.M, +) + + +def main() -> int: + files = [p for glob in SOURCES for p in ROOT.glob(glob)] + if not files: + print(" docs: no generated sources found", file=sys.stderr) + return 1 + + total = documented = 0 + undocumented: list[str] = [] + + for path in sorted(files): + text = path.read_text() + for match in OPERATION.finditer(text): + total += 1 + # The doc comment, if any, is the block immediately preceding the declaration. + # Locate it by walking back to the nearest close marker rather than using a fixed + # window: generated parameter docs routinely run past any window worth guessing. + preceding = text[: match.start()] + close = preceding.rfind("*/") + open_ = preceding.rfind("/**", 0, close) if close != -1 else -1 + between = preceding[close + 2 :].strip() if close != -1 else "x" + doc = preceding[open_ + 3 : close] if open_ != -1 and between == "" else "" + if len(doc.strip()) > 20: + documented += 1 + else: + undocumented.append(f"{path.name}:{match.group(1)}") + + if total == 0: + print(" docs: no operations found to check", file=sys.stderr) + return 1 + + ratio = documented / total + print(f" docs: {documented}/{total} operations documented ({ratio:.1%})") + + if ratio < THRESHOLD: + print(f" docs: FAIL below {THRESHOLD:.0%} (FR-004)", file=sys.stderr) + for name in undocumented[:10]: + print(f" undocumented: {name}", file=sys.stderr) + return 1 + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tools/patches/80_user_agent.py b/tools/patches/80_user_agent.py new file mode 100644 index 0000000..0171fca --- /dev/null +++ b/tools/patches/80_user_agent.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 +"""Flat-branded User-Agent that tracks the package version. Idempotent. + +The generator bakes its own literal from `artifactVersion` in generator config, which is a separate +number from VERSION and drifts from it. This reads VERSION at generation time, so the two cannot +disagree. +""" + +from __future__ import annotations + +import pathlib +import re +import sys + +ROOT = pathlib.Path(__file__).resolve().parent.parent.parent +TARGET = ROOT / "src" / "Configuration.php" +version = (ROOT / "VERSION").read_text().strip() + +text = TARGET.read_text() +# Match the whole line. Our replacement concatenates PHP_VERSION, so it contains both quotes and a +# semicolon: a literal-only or up-to-semicolon pattern would either miss it on the second run or +# truncate mid-string. The property is always emitted on one line. +pattern = re.compile(r"^ *protected string \$userAgent = .*$", re.M) +if not pattern.search(text): + sys.exit("80_user_agent: could not find the userAgent property (FR-025)") + +text = pattern.sub( + f" protected string $userAgent = 'Flat-SDK-PHP/{version} " + "(php/' . PHP_VERSION . ')';", + text, + count=1, +) +TARGET.write_text(text) +print(f" user-agent: Flat-SDK-PHP/{version}") diff --git a/tools/smoke.php b/tools/smoke.php new file mode 100644 index 0000000..a824b2b --- /dev/null +++ b/tools/smoke.php @@ -0,0 +1,256 @@ +#!/usr/bin/env php +`, it deletes what it created before returning, and it reads nothing else. + * + * Never prints a response body, token or account identifier (FR-016d). + */ + +use Flat\APIClient\ErrorFactory; +use Flat\APIClient\FlatAuthenticationError; +use Flat\APIClient\FlatAuthorizationError; +use Flat\APIClient\FlatClient; +use Flat\APIClient\FlatNotFoundError; +use Flat\APIClient\FlatRateLimitError; +use Flat\APIClient\FlatServerError; +use Flat\APIClient\Model\CollectionCreation; +use Flat\APIClient\Model\CollectionPrivacy; +use Flat\APIClient\Model\ScoreCreationFileImport; +use Flat\APIClient\Model\ScoreModification; +use Flat\APIClient\Model\ScorePrivacy; +use Flat\APIClient\RetryPolicy; +use Flat\APIClient\TokenManager; +use Flat\APIClient\Tokens; + +require_once __DIR__ . '/../vendor/autoload.php'; + +$redact = static fn (string $s): string => getenv('FLAT_SMOKE_REDACT') === '1' ? '' : $s; + +$failures = []; +$check = static function (string $name, bool $ok, string $detail = '') use (&$failures): void { + if ($ok) { + echo ' ', $name, " ... ok\n"; + return; + } + echo ' ', $name, " ... FAIL\n"; + $failures[] = $detail === '' ? $name : "$name: $detail"; +}; + +$scenariosPath = $argv[1] ?? null; +if ($scenariosPath === null) { + fwrite(STDERR, "usage: smoke.php \n"); + exit(2); +} +$token = getenv('FLAT_TEST_TOKEN'); +if ($token === false || $token === '') { + fwrite(STDERR, "FLAT_TEST_TOKEN is required\n"); + exit(2); +} + +// Every operation this suite calls, checked against the forbidden list rather than grepped for. +// The previous version tested the whole scenario file for the forbidden names, which the forbidden +// list itself always matched, so the suite exited 2 on every run. +$calls = [ + 'getAuthenticatedUser', 'createScore', 'getScore', 'editScore', 'getScoreRevisionData', + 'deleteScore', 'createCollection', 'listCollections', 'deleteCollection', +]; +$raw = (string) file_get_contents($scenariosPath); +$forbidden = []; +if (preg_match('/^forbidden_operations:\n((?:\s*-\s*\w+\n)+)/m', $raw, $m) === 1) { + foreach (explode("\n", $m[1]) as $line) { + $name = trim(preg_replace('/^\s*-\s*/', '', $line) ?? ''); + if ($name !== '') { + $forbidden[] = $name; + } + } +} +foreach ($calls as $op) { + if (in_array($op, $forbidden, true)) { + fwrite(STDERR, "refusing to run: $op is metered\n"); + exit(2); + } +} + +$fixture = dirname($scenariosPath) . '/fixtures/minimal.musicxml'; +if (!is_file($fixture)) { + fwrite(STDERR, "missing fixture: $fixture\n"); + exit(2); +} + +// Through FlatClient, deliberately: it is the entry point the README and QUICKSTART document, so +// the path a new user takes is the path this suite proves. It is also what installs the typed +// errors and the retry policy, which the generated Api classes do not carry on their own. +$client = new FlatClient(accessToken: $token); + +$createdScores = []; +$createdCollections = []; +$title = 'smoke-test-' . bin2hex(random_bytes(4)); + +try { + $me = $client->account()->getAuthenticatedUser(); + $check('whoami', method_exists($me, 'getId') && $me->getId() !== null, 'no id on the authenticated user'); + + $score = $client->scores()->createScore(new ScoreCreationFileImport([ + 'title' => $title, + // A backed enum, not a string: the setter's parameter type rejects the raw value. + 'privacy' => ScorePrivacy::_PRIVATE, + 'filename' => 'minimal.musicxml', + // base64 is the only encoding the API declares. + 'data' => base64_encode((string) file_get_contents($fixture)), + 'data_encoding' => 'base64', + ])); + // Registered before anything else can fail, so the finally block always reclaims it. + if (method_exists($score, 'getId') && $score->getId() !== null) { + $createdScores[] = $score->getId(); + } + $check('create-score', count($createdScores) === 1, 'no id on the created score'); + if ($createdScores === []) { + throw new RuntimeException('create-score returned no id'); + } + $scoreId = $createdScores[0]; + + $fetched = $client->scores()->getScore($scoreId); + $check('read-score', $fetched->getId() === $scoreId, 'the score read back is not the one created'); + + $renamed = $title . '-renamed'; + $updated = $client->scores()->editScore($scoreId, new ScoreModification(['title' => $renamed])); + $check('update-score-metadata', $updated->getTitle() === $renamed, 'the title did not change'); + + $exported = $client->scores()->getScoreRevisionData($scoreId, 'last', 'mxl'); + $check('export-score', $exported !== null, 'the export returned nothing'); + + // Three collections, so the traversal below has a page boundary to cross. + for ($i = 0; $i < 3; $i++) { + $collection = $client->collections()->createCollection(new CollectionCreation([ + 'title' => "$title-collection-$i", + 'privacy' => CollectionPrivacy::_PRIVATE, + ])); + if ($collection->getId() !== null) { + $createdCollections[] = $collection->getId(); + } + } + $check('create-collections', count($createdCollections) === 3, 'could not create three collections'); + + // limit: 1 forces one request per item, so the traversal cannot succeed without following the + // cursor. An earlier version asked for a page larger than the account held, never requested a + // second page, and proved nothing. + $seen = []; + foreach ($client->paginate('listCollections', ['parent' => 'user', 'limit' => 1]) as $item) { + $seen[] = $item->getId(); + } + $missing = array_values(array_diff($createdCollections, $seen)); + $duplicated = array_values(array_filter(array_count_values(array_filter($seen)), static fn ($n) => $n > 1)); + $check( + 'paginate-across-pages', + count($seen) > 1 && $missing === [] && $duplicated === [], + sprintf('pages=%d missing=%d duplicated=%d', count($seen), count($missing), count($duplicated)) + ); + + try { + $client->scores()->getScore('000000000000000000000000'); + $check('typed-not-found', false, 'no error raised for a missing score'); + } catch (FlatNotFoundError) { + $check('typed-not-found', true); + } catch (Throwable $e) { + $check('typed-not-found', false, sprintf('raised %s, not FlatNotFoundError', $e::class)); + } + + try { + // A separate client, so the bad token cannot leak into the one doing the cleanup. + (new FlatClient(accessToken: 'invalid'))->account()->getAuthenticatedUser(); + $check('typed-auth-error', false, 'no error raised for an invalid token'); + } catch (FlatAuthenticationError) { + $check('typed-auth-error', true); + } catch (Throwable $e) { + $check('typed-auth-error', false, sprintf('raised %s, not FlatAuthenticationError', $e::class)); + } + + // The retry policy reaches the request path, and makes the right calls. A real throttle cannot + // be induced without hammering production, so this asserts the wiring and the decisions. + $policy = $client->retryPolicy(); + $retriesThrottle = $policy->shouldRetry(new FlatRateLimitError('x', 403), 'GET', 1); + $retries5xx = $policy->shouldRetry(new FlatServerError('x', 502), 'GET', 1); + // A plain 403 is a genuine authorization failure; retrying it would be worse than not retrying. + $keeps403 = !$policy->shouldRetry(new FlatAuthorizationError('x', 403), 'GET', 1); + // A POST may already have been applied, so it must not be replayed. + $keepsPost = !$policy->shouldRetry(new FlatServerError('x', 502), 'POST', 1); + $check( + 'retry-policy-applied', + $policy instanceof RetryPolicy && $retriesThrottle && $retries5xx && $keeps403 && $keepsPost, + sprintf( + 'throttle=%s 5xx=%s keeps403=%s keepsPost=%s', + var_export($retriesThrottle, true), var_export($retries5xx, true), + var_export($keeps403, true), var_export($keepsPost, true) + ) + ); + + // An expired token is noticed rather than sent. accessToken() used to return the stored token + // whatever its state, which made Tokens::expired() dead code and every request after the + // expiry fail with a 401 a refresh would have avoided. + // + // Checked without a stub helper: OAuth2Helper is final, so it cannot be subclassed, and the + // expiry branch is what matters here. A fresh token is returned untouched; an expired one with + // nothing to refresh from raises the typed error, which only happens if the branch is reached. + $fresh = new TokenManager(new Tokens('fresh', 'r', time() + 3600)); + $returnsFresh = $fresh->accessToken() === 'fresh'; + + $noticesExpiry = false; + try { + (new TokenManager(new Tokens('stale', null, time() - 60)))->accessToken(); + } catch (FlatAuthenticationError) { + $noticesExpiry = true; + } + $check( + 'oauth-notices-expiry', + $returnsFresh && $noticesExpiry && (new Tokens('x', null, time() - 1))->expired(), + sprintf('fresh=%s expired=%s', var_export($returnsFresh, true), var_export($noticesExpiry, true)) + ); + +} catch (Throwable $e) { + // The class and status, never the message: a message can quote a request body, and this runs + // with redaction on precisely so a failure does not become a disclosure. + if ($e instanceof \Flat\APIClient\FlatError) { + $failures[] = sprintf('unhandled %s status=%s code=%s', $e::class, var_export($e->status, true), var_export($e->errorCode, true)); + } else { + // File and line rather than the message: a message can quote a value, and this runs with + // redaction on precisely so a failure does not become a disclosure. The location is enough + // to find a local fault, which "" never was. + $failures[] = sprintf('unhandled %s at %s:%d', $e::class, basename($e->getFile()), $e->getLine()); + } +} finally { + foreach ($createdScores as $id) { + try { + $client->scores()->deleteScore($id); + echo ' cleanup score ', $redact($id), " ... deleted\n"; + } catch (Throwable $e) { + $failures[] = sprintf('cleanup failed for score %s: %s', $redact($id), $e::class); + } + } + foreach ($createdCollections as $id) { + try { + $client->collections()->deleteCollection($id); + echo ' cleanup collection ', $redact($id), " ... deleted\n"; + } catch (Throwable $e) { + $failures[] = sprintf('cleanup failed for collection %s: %s', $redact($id), $e::class); + } + } +} + +if ($failures !== []) { + foreach ($failures as $f) { + fwrite(STDERR, " FAIL $f\n"); + } + exit(1); +} + +echo "smoke: PASS\n";